[Libreoffice-commits] .: starmath/qa

Caolán McNamara caolan at kemper.freedesktop.org
Mon Nov 29 13:24:27 PST 2010


 starmath/qa/cppunit/test_starmath.cxx |   29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

New commits:
commit 71ed97200bd1fbb7f47cc76596cc4755a7074394
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Nov 29 21:24:16 2010 +0000

    cppunit: add a zoom test

diff --git a/starmath/qa/cppunit/test_starmath.cxx b/starmath/qa/cppunit/test_starmath.cxx
index 4c77c34..a3df1fd 100644
--- a/starmath/qa/cppunit/test_starmath.cxx
+++ b/starmath/qa/cppunit/test_starmath.cxx
@@ -47,11 +47,14 @@ public:
 
     // tests
     void createDocument();
+
     void tmEditUndoRedo(SmDocShellRef &rDocShRef);
     void tmEditAllClipboard(SmEditWindow &rEditWindow);
     void tmEditMarker(SmEditWindow &rEditWindow);
     void tmEditFailure(SmDocShellRef &rDocShRef);
 
+    void tViewZoom(SmViewShell &rViewShell);
+
     CPPUNIT_TEST_SUITE(Test);
     CPPUNIT_TEST(createDocument);
     CPPUNIT_TEST_SUITE_END();
@@ -249,6 +252,28 @@ void Test::tmEditUndoRedo(SmDocShellRef &rDocShRef)
 
 }
 
+void Test::tViewZoom(SmViewShell &rViewShell)
+{
+    sal_uInt16 nOrigZoom, nNextZoom, nFinalZoom;
+
+    SmGraphicWindow &rGraphicWindow = rViewShell.GetGraphicWindow();
+    nOrigZoom = rGraphicWindow.GetZoom();
+
+    {
+        SfxRequest aZoomIn(SID_ZOOMIN, SFX_CALLMODE_SYNCHRON, rViewShell.GetPool());
+        rViewShell.Execute(aZoomIn);
+        nNextZoom = rGraphicWindow.GetZoom();
+        CPPUNIT_ASSERT_MESSAGE("Should be bigger", nNextZoom > nOrigZoom);
+    }
+
+    {
+        SfxRequest aZoomOut(SID_ZOOMOUT, SFX_CALLMODE_SYNCHRON, rViewShell.GetPool());
+        rViewShell.Execute(aZoomOut);
+        nFinalZoom = rGraphicWindow.GetZoom();
+        CPPUNIT_ASSERT_MESSAGE("Should be equal", nFinalZoom == nOrigZoom);
+    }
+}
+
 void Test::createDocument()
 {
     SmDocShellRef xDocShRef = new SmDocShell(SFXOBJECTSHELL_STD_NORMAL);
@@ -268,12 +293,16 @@ void Test::createDocument()
     aBindings.SetDispatcher(&aDispatcher);
     SmCmdBoxWindow aSmCmdBoxWindow(&aBindings, NULL, NULL);
     SmEditWindow aEditWindow(aSmCmdBoxWindow);
+    SmViewShell *pViewShell = aEditWindow.GetView();
+    CPPUNIT_ASSERT_MESSAGE("Should have a SmViewShell", pViewShell);
 
     tmEditUndoRedo(xDocShRef);
     tmEditAllClipboard(aEditWindow);
     tmEditMarker(aEditWindow);
     tmEditFailure(xDocShRef);
 
+    tViewZoom(*pViewShell);
+
     xDocShRef.Clear();
 }
 


More information about the Libreoffice-commits mailing list