Add unit tests for history clearing and enabling / disabling.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68189 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Steve Lamerton 2011-07-08 14:21:46 +00:00
parent d07fd8b021
commit f152b4b93f

View File

@ -37,11 +37,15 @@ private:
CPPUNIT_TEST( Title );
CPPUNIT_TEST( Url );
CPPUNIT_TEST( History );
CPPUNIT_TEST( HistoryEnable );
CPPUNIT_TEST( HistoryClear );
CPPUNIT_TEST_SUITE_END();
void Title();
void Url();
void History();
void HistoryEnable();
void HistoryClear();
wxWebView* m_browser;
@ -115,4 +119,41 @@ void WebTestCase::History()
CPPUNIT_ASSERT(m_browser->CanGoForward());
}
void WebTestCase::HistoryEnable()
{
m_browser->LoadUrl("about:blank");
wxYield();
m_browser->EnableHistory(false);
CPPUNIT_ASSERT(!m_browser->CanGoForward());
CPPUNIT_ASSERT(!m_browser->CanGoBack());
m_browser->LoadUrl("about:blank");
wxYield();
CPPUNIT_ASSERT(!m_browser->CanGoForward());
CPPUNIT_ASSERT(!m_browser->CanGoBack());
}
void WebTestCase::HistoryClear()
{
m_browser->LoadUrl("about:blank");
wxYield();
m_browser->LoadUrl("about:blank");
wxYield();
//Now we are in the 'middle' of the history
m_browser->GoBack();
CPPUNIT_ASSERT(m_browser->CanGoForward());
CPPUNIT_ASSERT(m_browser->CanGoBack());
m_browser->ClearHistory();
CPPUNIT_ASSERT(!m_browser->CanGoForward());
CPPUNIT_ASSERT(!m_browser->CanGoBack());
}
#endif //wxUSE_WEB