]> git.saurik.com Git - wxWidgets.git/commitdiff
Add unit tests for zoom functions
authorSteve Lamerton <steve.lamerton@gmail.com>
Thu, 14 Jul 2011 14:02:14 +0000 (14:02 +0000)
committerSteve Lamerton <steve.lamerton@gmail.com>
Thu, 14 Jul 2011 14:02:14 +0000 (14:02 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68270 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

tests/controls/webtest.cpp

index 5e5dfbd5a26112b8972612b3deabb35820d34d3f..b2c692a39baf49bc347da4e604329ceec6c91a00 100644 (file)
@@ -42,6 +42,7 @@ private:
         CPPUNIT_TEST( HistoryList );
         CPPUNIT_TEST( Editable );
         CPPUNIT_TEST( Selection );
+        CPPUNIT_TEST( Zoom );
     CPPUNIT_TEST_SUITE_END();
 
     void Title();
@@ -52,6 +53,7 @@ private:
     void HistoryList();
     void Editable();
     void Selection();
+    void Zoom();
     void LoadUrl(const wxString& url, int times = 1);
 
     wxWebView* m_browser;
@@ -203,4 +205,30 @@ void WebTestCase::Selection()
     CPPUNIT_ASSERT(!m_browser->HasSelection());
 }
 
+void WebTestCase::Zoom()
+{
+    CPPUNIT_ASSERT_EQUAL(wxWEB_VIEW_ZOOM_MEDIUM, m_browser->GetZoom());
+
+    if(m_browser->CanSetZoomType(wxWEB_VIEW_ZOOM_TYPE_LAYOUT))
+    {
+        m_browser->SetZoomType(wxWEB_VIEW_ZOOM_TYPE_LAYOUT);
+        CPPUNIT_ASSERT_EQUAL(wxWEB_VIEW_ZOOM_TYPE_LAYOUT, m_browser->GetZoomType());
+
+        m_browser->SetZoom(wxWEB_VIEW_ZOOM_TINY);
+        CPPUNIT_ASSERT_EQUAL(wxWEB_VIEW_ZOOM_TINY, m_browser->GetZoom());
+    }
+
+    //Reset the zoom level
+    m_browser->SetZoom(wxWEB_VIEW_ZOOM_MEDIUM);
+
+    if(m_browser->CanSetZoomType(wxWEB_VIEW_ZOOM_TYPE_TEXT))
+    {
+        m_browser->SetZoomType(wxWEB_VIEW_ZOOM_TYPE_TEXT);
+        CPPUNIT_ASSERT_EQUAL(wxWEB_VIEW_ZOOM_TYPE_TEXT, m_browser->GetZoomType());
+
+        m_browser->SetZoom(wxWEB_VIEW_ZOOM_TINY);
+        CPPUNIT_ASSERT_EQUAL(wxWEB_VIEW_ZOOM_TINY, m_browser->GetZoom());
+    }
+}
+
 #endif //wxUSE_WEB