]> git.saurik.com Git - wxWidgets.git/commitdiff
Add unit tests for history clearing and enabling / disabling.
authorSteve Lamerton <steve.lamerton@gmail.com>
Fri, 8 Jul 2011 14:21:46 +0000 (14:21 +0000)
committerSteve Lamerton <steve.lamerton@gmail.com>
Fri, 8 Jul 2011 14:21:46 +0000 (14:21 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68189 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

tests/controls/webtest.cpp

index f3b62668171473c762822158b8ec868e5bb0182a..74360c9c5386f42a18dfc2597f295b3cc66442c6 100644 (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