From 18cf6bb5b4eabd8a1eb1179a6712504b292d9dfa Mon Sep 17 00:00:00 2001 From: Steve Lamerton Date: Thu, 14 Jul 2011 14:02:14 +0000 Subject: [PATCH] Add unit tests for zoom functions git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68270 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- tests/controls/webtest.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/controls/webtest.cpp b/tests/controls/webtest.cpp index 5e5dfbd5a2..b2c692a39b 100644 --- a/tests/controls/webtest.cpp +++ b/tests/controls/webtest.cpp @@ -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 -- 2.47.2