File indexing completed on 2024-12-22 04:12:54
0001 /* 0002 * SPDX-FileCopyrightText: 2012 Dmitry Kazakov <dimula73@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef __KIS_ZOOM_AND_PAN_TEST_H 0008 #define __KIS_ZOOM_AND_PAN_TEST_H 0009 0010 #include <simpletest.h> 0011 0012 class ZoomAndPanTester; 0013 0014 0015 class KisZoomAndPanTest : public QObject 0016 { 0017 Q_OBJECT 0018 private Q_SLOTS: 0019 void testZoom100ChangingWidgetSize(); 0020 void testZoomOnBorderZoomLevels(); 0021 0022 void testSequentialActionZoomAndPan(); 0023 void testSequentialActionZoomAndPanFullscreen(); 0024 void testSequentialActionZoomAndPanRotate(); 0025 void testSequentialActionZoomAndPanRotateFullscreen(); 0026 void testSequentialActionZoomAndPanMirror(); 0027 0028 void testSequentialWheelZoomAndPan(); 0029 void testSequentialWheelZoomAndPanFullscreen(); 0030 void testSequentialWheelZoomAndPanRotate(); 0031 void testSequentialWheelZoomAndPanRotateFullscreen(); 0032 void testSequentialWheelZoomAndPanMirror(); 0033 0034 void testImageRescaled_0_5(); 0035 void testImageCropped(); 0036 0037 void testRotation_VastScrolling_1_0(); 0038 void testRotation_VastScrolling_0_5(); 0039 0040 void testRotation_NoVastScrolling_1_0(); 0041 void testRotation_NoVastScrolling_0_5(); 0042 0043 private: 0044 0045 bool checkInvariants(const QPointF &baseFlakePoint, 0046 const QPoint &oldOffset, 0047 const QPointF &oldPreferredCenter, 0048 qreal oldZoom, 0049 const QPoint &newOffset, 0050 const QPointF &newPreferredCenter, 0051 qreal newZoom, 0052 const QPointF &newTopLeft, 0053 const QSize &oldDocumentSize); 0054 0055 bool checkZoomWithAction(ZoomAndPanTester &t, qreal newZoom, bool limitedZoom = false); 0056 bool checkZoomWithWheel(ZoomAndPanTester &t, const QPoint &widgetPoint, qreal zoomCoeff, bool limitedZoom = false); 0057 bool checkPan(ZoomAndPanTester &t, QPoint shift); 0058 bool checkRotation(ZoomAndPanTester &t, qreal angle); 0059 0060 void initializeViewport(ZoomAndPanTester &t, bool fullscreenMode, bool rotate, bool mirror); 0061 void testSequentialActionZoomAndPan(bool fullscreenMode, bool rotate, bool mirror); 0062 void testSequentialWheelZoomAndPan(bool fullscreenMode, bool rotate, bool mirror); 0063 void testRotation(qreal vastScrolling, qreal zoom); 0064 }; 0065 0066 #endif /* __KIS_ZOOM_AND_PAN_TEST_H */