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:
@@ -34,8 +34,11 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
CPPUNIT_TEST_SUITE( WebTestCase );
|
CPPUNIT_TEST_SUITE( WebTestCase );
|
||||||
|
CPPUNIT_TEST( Title );
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
|
void Title();
|
||||||
|
|
||||||
wxWebView* m_browser;
|
wxWebView* m_browser;
|
||||||
|
|
||||||
DECLARE_NO_COPY_CLASS(WebTestCase)
|
DECLARE_NO_COPY_CLASS(WebTestCase)
|
||||||
@@ -49,7 +52,7 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( WebTestCase, "WebTestCase" );
|
|||||||
|
|
||||||
void WebTestCase::setUp()
|
void WebTestCase::setUp()
|
||||||
{
|
{
|
||||||
m_browser = wxWebView::New(wxTheApp->GetTopWindow(), wxID_ANY, "about:blank");
|
m_browser = wxWebView::New(wxTheApp->GetTopWindow(), wxID_ANY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebTestCase::tearDown()
|
void WebTestCase::tearDown()
|
||||||
@@ -57,4 +60,18 @@ void WebTestCase::tearDown()
|
|||||||
wxDELETE(m_browser);
|
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
|
#endif //wxUSE_WEB
|
||||||
|
Reference in New Issue
Block a user