Add tests for the page title

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68187 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Steve Lamerton
2011-07-08 10:51:15 +00:00
parent 2dad08eca5
commit 6a2ef29f66

View 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