From 6a2ef29f66095308e29b01e04132caaebd8356ad Mon Sep 17 00:00:00 2001 From: Steve Lamerton Date: Fri, 8 Jul 2011 10:51:15 +0000 Subject: [PATCH] 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 --- tests/controls/webtest.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/controls/webtest.cpp b/tests/controls/webtest.cpp index 34cb468c9e..9ac8303318 100644 --- a/tests/controls/webtest.cpp +++ b/tests/controls/webtest.cpp @@ -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("Title", ""); + 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 -- 2.45.2