From f152b4b93f41c3eb0b343dca54fd59e4a50755dc Mon Sep 17 00:00:00 2001 From: Steve Lamerton Date: Fri, 8 Jul 2011 14:21:46 +0000 Subject: [PATCH] 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 --- tests/controls/webtest.cpp | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/controls/webtest.cpp b/tests/controls/webtest.cpp index f3b6266817..74360c9c53 100644 --- a/tests/controls/webtest.cpp +++ b/tests/controls/webtest.cpp @@ -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 -- 2.45.2