Пример #1
0
    def test_onZoomOut(self):
        """
        Test zoom out
        """
        currentZoom = self.app.canvas.plotter.zoom
        event = MouseEvent(name = "button_press_event", button = MouseButton.LEFT, canvas = self.app.canvas.canvas, x = 503, y = 670)
        event.xdata = -90
        event.ydata = 45
        event.button = MouseButton.LEFT
        self.app.canvas.onZoomIn(event)

        event.xdata = 1
        event.ydata = 1
        self.app.canvas.onZoomOut(event)
        self.assertEqual(self.app.canvas.plotter.zoom, currentZoom)
Пример #2
0
 def test_onZoomIn1(self):
     """
     Test zoom in on bottom-right quadrant
     """
     currentZoom = self.app.canvas.plotter.zoom
     event = MouseEvent(name = "button_press_event", button = MouseButton.LEFT, canvas = self.app.canvas.canvas, x = 503, y = 670)
     event.xdata = 90
     event.ydata = -45
     event.button = MouseButton.LEFT
     self.app.canvas.onZoomIn(event)
     self.assertEqual(self.app.canvas.plotter.zoom, currentZoom + 1)
Пример #3
0
    def test_zoomInBottomRightAndZoomOut(self):
        """
        Tests the zoomIn and zoomOut function for the bottom-right quadrant
        """
        event = MouseEvent(name = "button_press_event", button = MouseButton.LEFT, canvas = self.app.canvas.canvas, x = 503, y = 670)
        event.xdata = 90
        event.ydata = -45
        event.button = MouseButton.LEFT
        currentZoom = self.app.canvas.plotter.zoom
        currentCenterX = self.app.canvas.plotter.centerX
        currentCenterY = self.app.canvas.plotter.centerY
        width = self.app.canvas.plotter.width
        height = self.app.canvas.plotter.height

        self.app.canvas.plotter.zoomIn(event)
        self.assertEqual(self.app.canvas.plotter.zoom, currentZoom + 1)
        self.assertEqual(self.app.canvas.plotter.centerX, currentCenterX + width/4)
        self.assertEqual(self.app.canvas.plotter.centerY, currentCenterY - height/4)

        self.app.canvas.plotter.zoomOut(event)
        self.assertEqual(self.app.canvas.plotter.zoom, currentZoom)
        self.assertEqual(self.app.canvas.plotter.centerX, currentCenterX)
        self.assertEqual(self.app.canvas.plotter.centerY, currentCenterY)