Add tests for url and history support

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68188 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Steve Lamerton
2011-07-08 13:11:17 +00:00
parent 6a2ef29f66
commit d07fd8b021

View File

@@ -35,9 +35,13 @@ public:
private:
CPPUNIT_TEST_SUITE( WebTestCase );
CPPUNIT_TEST( Title );
CPPUNIT_TEST( Url );
CPPUNIT_TEST( History );
CPPUNIT_TEST_SUITE_END();
void Title();
void Url();
void History();
wxWebView* m_browser;
@@ -74,4 +78,41 @@ void WebTestCase::Title()
CPPUNIT_ASSERT_EQUAL("", m_browser->GetCurrentTitle());
}
void WebTestCase::Url()
{
CPPUNIT_ASSERT_EQUAL("", m_browser->GetCurrentURL());
m_browser->LoadUrl("about:blank");
wxYield();
CPPUNIT_ASSERT_EQUAL("about:blank", m_browser->GetCurrentURL());
}
void WebTestCase::History()
{
//We use about:blank to remove the need for a network connection
m_browser->LoadUrl("about:blank");
wxYield();
m_browser->LoadUrl("about:blank");
wxYield();
m_browser->LoadUrl("about:blank");
wxYield();
CPPUNIT_ASSERT(m_browser->CanGoBack());
CPPUNIT_ASSERT(!m_browser->CanGoForward());
m_browser->GoBack();
CPPUNIT_ASSERT(m_browser->CanGoBack());
CPPUNIT_ASSERT(m_browser->CanGoForward());
m_browser->GoBack();
m_browser->GoBack();
//We should now be at the start of the history
CPPUNIT_ASSERT(!m_browser->CanGoBack());
CPPUNIT_ASSERT(m_browser->CanGoForward());
}
#endif //wxUSE_WEB