]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/controls/webtest.cpp
Fix wxOSX warnings about int-to-void* casts.
[wxWidgets.git] / tests / controls / webtest.cpp
index 6b9e093e00e54f0c55ab703685dd8f099eff7a70..9397843ee8c682cc7161e30d0d73cdc0afba5c19 100644 (file)
@@ -3,7 +3,6 @@
 // Purpose:     wxWebView unit test
 // Author:      Steven Lamerton
 // Created:     2011-07-08
-// RCS-ID:      $Id$
 // Copyright:   (c) 2011 Steven Lamerton
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -79,7 +78,8 @@ void WebTestCase::setUp()
 {
     m_browser = wxWebView::New(wxTheApp->GetTopWindow(), wxID_ANY);
 
-    m_loaded = new EventCounter(m_browser, wxEVT_COMMAND_WEBVIEW_LOADED);
+    m_loaded = new EventCounter(m_browser, wxEVT_WEBVIEW_LOADED);
+    m_browser->LoadURL("about:blank");
     ENSURE_LOADED;
 }
 
@@ -219,9 +219,18 @@ void WebTestCase::Selection()
 
     CPPUNIT_ASSERT(m_browser->HasSelection());
     CPPUNIT_ASSERT_EQUAL("Some strong text", m_browser->GetSelectedText());
-    //We lower case the result as ie returns tags in uppercase
-    CPPUNIT_ASSERT_EQUAL("some <strong>strong</strong> text",
-                         m_browser->GetSelectedSource().Lower());
+
+    // The web engine doesn't necessarily represent the HTML in the same way as
+    // we used above, e.g. IE uses upper case for all the tags while WebKit
+    // under OS X inserts plenty of its own <span> tags, so don't test for
+    // equality and just check that the source contains things we'd expect it
+    // to.
+    const wxString selSource = m_browser->GetSelectedSource();
+    WX_ASSERT_MESSAGE
+    (
+        ("Unexpected selection source: \"%s\"", selSource),
+        selSource.Lower().Matches("*some*<strong*strong</strong>*text*")
+    );
 
     m_browser->ClearSelection();
     CPPUNIT_ASSERT(!m_browser->HasSelection());