[Skencil-commits] r526 - skencil/trunk/test

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Sat Mar 4 21:45:16 CET 2006


Author: bh
Date: 2006-03-04 21:45:16 +0100 (Sat, 04 Mar 2006)
New Revision: 526

Modified:
   skencil/trunk/test/ChangeLog
   skencil/trunk/test/test_tools.py
Log:
* test_tools.py (MockZoomCanvas.zoom_point): New.  For the point
zoom tests
(TestZoomTool.test_point_zoom_in)
(TestZoomTool.test_point_zoom_out): New.  Test zooming with a
single click.


Modified: skencil/trunk/test/ChangeLog
===================================================================
--- skencil/trunk/test/ChangeLog	2006-02-26 22:53:24 UTC (rev 525)
+++ skencil/trunk/test/ChangeLog	2006-03-04 20:45:16 UTC (rev 526)
@@ -1,3 +1,11 @@
+2006-03-04  Bernhard Herzog  <bh at intevation.de>
+
+	* test_tools.py (MockZoomCanvas.zoom_point): New.  For the point
+	zoom tests
+	(TestZoomTool.test_point_zoom_in)
+	(TestZoomTool.test_point_zoom_out): New.  Test zooming with a
+	single click.
+
 2006-02-26  Bernhard Herzog  <bh at intevation.de>
 
 	* test_tools.py (MockZoomCanvas): New helper class for the Zoom

Modified: skencil/trunk/test/test_tools.py
===================================================================
--- skencil/trunk/test/test_tools.py	2006-02-26 22:53:24 UTC (rev 525)
+++ skencil/trunk/test/test_tools.py	2006-03-04 20:45:16 UTC (rev 526)
@@ -353,7 +353,10 @@
     def zoom_area(self, rect, out):
         self.called_methods.append(("zoom_area", rect, out))
 
+    def zoom_point(self, point, out):
+        self.called_methods.append(("zoom_point", point, out))
 
+
 class TestZoomTool(unittest.TestCase):
 
     def setUp(self):
@@ -399,6 +402,28 @@
         self.assertEquals(self.canvas.called_methods,
                           [("zoom_area", Rect(123, 47, 150, 60),  ZoomOutMask)])
 
+    def test_point_zoom_in(self):
+        """Test a point zoom that zooms in"""
+        self.editor.SetTool("ZoomTool")
+        self.editor.ButtonClick(self.canvas, Point(123, 47), Button1,
+                                Button1Mask)
+
+        # zoom_area must have been called with out set to a false value
+        self.assertEquals(self.canvas.called_methods,
+                          [("zoom_point", Point(123, 47),  0)])
+
+    def test_point_zoom_out(self):
+        """Test a point zoom that zooms out"""
+        self.editor.SetTool("ZoomTool")
+        self.editor.ButtonClick(self.canvas, Point(123, 47), Button1,
+                                Button1Mask|ZoomOutMask)
+
+        # zoom_area must have been called with "out" set to a true value.
+        # Ideally it should be True, but the actual implementation uses
+        # ZoomOutMask currently.
+        self.assertEquals(self.canvas.called_methods,
+                          [("zoom_point", Point(123, 47), ZoomOutMask)])
+
     def test_activating_zoom_during_drag(self):
         """Test activating the zoom tool during a drag
 



More information about the Skencil-commits mailing list