]> git.saurik.com Git - wxWidgets.git/commitdiff
Add tests for the page title
authorSteve Lamerton <steve.lamerton@gmail.com>
Fri, 8 Jul 2011 10:51:15 +0000 (10:51 +0000)
committerSteve Lamerton <steve.lamerton@gmail.com>
Fri, 8 Jul 2011 10:51:15 +0000 (10:51 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68187 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

tests/controls/webtest.cpp

index 34cb468c9edf2319ea47d8971e56bd307ec14a21..9ac8303318c3101a49ba6faabf63c5190ffac0a2 100644 (file)
@@ -34,8 +34,11 @@ public:
 
 private:
     CPPUNIT_TEST_SUITE( WebTestCase );
+        CPPUNIT_TEST( Title );
     CPPUNIT_TEST_SUITE_END();
 
+    void Title();
+
     wxWebView* m_browser;
 
     DECLARE_NO_COPY_CLASS(WebTestCase)
@@ -49,7 +52,7 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( WebTestCase, "WebTestCase" );
 
 void WebTestCase::setUp()
 {
-    m_browser = wxWebView::New(wxTheApp->GetTopWindow(), wxID_ANY, "about:blank");
+    m_browser = wxWebView::New(wxTheApp->GetTopWindow(), wxID_ANY);
 }
 
 void WebTestCase::tearDown()
@@ -57,4 +60,18 @@ void WebTestCase::tearDown()
     wxDELETE(m_browser);
 }
 
+void WebTestCase::Title()
+{
+    CPPUNIT_ASSERT_EQUAL("", m_browser->GetCurrentTitle());
+
+    //Test title after loading raw html
+    m_browser->SetPage("<html><title>Title</title></html>", "");
+    CPPUNIT_ASSERT_EQUAL("Title", m_browser->GetCurrentTitle());
+
+    //Test title after loading a url, we yield to let events process
+    m_browser->LoadUrl("about:blank");
+    wxYield();
+    CPPUNIT_ASSERT_EQUAL("", m_browser->GetCurrentTitle());
+}
+
 #endif //wxUSE_WEB