1 /* 2 * Copyright (c) 2012 Dmitry Kazakov <dimula73@gmail.com> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 */ 18 19 #ifndef __KIS_ZOOM_AND_PAN_TEST_H 20 #define __KIS_ZOOM_AND_PAN_TEST_H 21 22 #include <QtTest> 23 24 class ZoomAndPanTester; 25 26 27 class KisZoomAndPanTest : public QObject 28 { 29 Q_OBJECT 30 private Q_SLOTS: 31 void testZoom100ChangingWidgetSize(); 32 void testZoomOnBorderZoomLevels(); 33 34 void testSequentialActionZoomAndPan(); 35 void testSequentialActionZoomAndPanFullscreen(); 36 void testSequentialActionZoomAndPanRotate(); 37 void testSequentialActionZoomAndPanRotateFullscreen(); 38 void testSequentialActionZoomAndPanMirror(); 39 40 void testSequentialWheelZoomAndPan(); 41 void testSequentialWheelZoomAndPanFullscreen(); 42 void testSequentialWheelZoomAndPanRotate(); 43 void testSequentialWheelZoomAndPanRotateFullscreen(); 44 void testSequentialWheelZoomAndPanMirror(); 45 46 void testImageRescaled_0_5(); 47 void testImageCropped(); 48 49 void testRotation_VastScrolling_1_0(); 50 void testRotation_VastScrolling_0_5(); 51 52 void testRotation_NoVastScrolling_1_0(); 53 void testRotation_NoVastScrolling_0_5(); 54 55 private: 56 57 bool checkInvariants(const QPointF &baseFlakePoint, 58 const QPoint &oldOffset, 59 const QPointF &oldPreferredCenter, 60 qreal oldZoom, 61 const QPoint &newOffset, 62 const QPointF &newPreferredCenter, 63 qreal newZoom, 64 const QPointF &newTopLeft, 65 const QSize &oldDocumentSize); 66 67 bool checkZoomWithAction(ZoomAndPanTester &t, qreal newZoom, bool limitedZoom = false); 68 bool checkZoomWithWheel(ZoomAndPanTester &t, const QPoint &widgetPoint, qreal zoomCoeff, bool limitedZoom = false); 69 bool checkPan(ZoomAndPanTester &t, QPoint shift); 70 bool checkRotation(ZoomAndPanTester &t, qreal angle); 71 72 void initializeViewport(ZoomAndPanTester &t, bool fullscreenMode, bool rotate, bool mirror); 73 void testSequentialActionZoomAndPan(bool fullscreenMode, bool rotate, bool mirror); 74 void testSequentialWheelZoomAndPan(bool fullscreenMode, bool rotate, bool mirror); 75 void testRotation(qreal vastScrolling, qreal zoom); 76 }; 77 78 #endif /* __KIS_ZOOM_AND_PAN_TEST_H */ 79