Engauge Digitizer 2
Loading...
Searching...
No Matches
TestZoomTransition.cpp
Go to the documentation of this file.
1#include "Logger.h"
2#include "MainWindow.h"
3#include <QtTest/QtTest>
5#include "ZoomTransition.h"
6
7QTEST_MAIN (TestZoomTransition)
8
9using namespace std;
10
11const bool FILL_CHECKED = true;
12const bool FILL_UNCHECKED = false;
13const double M11 = 1.9;
14const double M22 = 1.49;
15
17 QObject(parent)
18{
19}
20
21void TestZoomTransition::cleanupTestCase ()
22{
23
24}
25
26void TestZoomTransition::initTestCase ()
27{
28 const bool NO_DROP_REGRESSION = false;
29 const QString NO_ERROR_REPORT_LOG_FILE;
30 const QString NO_REGRESSION_OPEN_FILE;
31 const bool NO_GNUPLOT_LOG_FILES = false;
32 const bool NO_REGRESSION_IMPORT = false;
33 const bool NO_RESET = false;
34 const bool NO_EXPORT_ONLY = false;
35 const bool NO_EXTRACT_IMAGE_ONLY = false;
36 const QString NO_EXTRACT_IMAGE_EXTENSION;
37 const bool DEBUG_FLAG = false;
38 const QStringList NO_LOAD_STARTUP_FILES;
39 const QStringList NO_COMMAND_LINE;
40
41 initializeLogging ("engauge_test",
42 "engauge_test.log",
44
45 MainWindow w (NO_ERROR_REPORT_LOG_FILE,
50 NO_RESET,
56 w.show ();
57}
58
59void TestZoomTransition::testInAtClosestEnum ()
60{
61 ZoomTransition zoomTransition;
62 ZoomFactor zoomFactorNew = zoomTransition.zoomIn (ZOOM_16_TO_1,
63 M11,
64 M22,
66
67 // Should be unchanged since cannot go further
68 QVERIFY (zoomFactorNew == ZOOM_16_TO_1);
69}
70
71void TestZoomTransition::testInBeforeClosestFromEnum ()
72{
73 ZoomTransition zoomTransition;
74 ZoomFactor zoomFactorNew = zoomTransition.zoomIn (ZOOM_1_TO_1,
75 M11,
76 M22,
78
79 QVERIFY (zoomFactorNew == ZOOM_1_TO_1_CLOSER);
80}
81
82void TestZoomTransition::testInBeforeClosestFromFill ()
83{
84 ZoomTransition zoomTransition;
85 ZoomFactor zoomFactorNew = zoomTransition.zoomIn (ZOOM_FILL,
86 M11,
87 M22,
89
90 QVERIFY (zoomFactorNew == ZOOM_2_TO_1);
91}
92
93void TestZoomTransition::testOutAtFarthestEnum ()
94{
95 ZoomTransition zoomTransition;
96 ZoomFactor zoomFactorNew = zoomTransition.zoomOut (ZOOM_1_TO_16,
97 M11,
98 M22,
100
101 // Should be unchanged since cannot go further
102 QVERIFY (zoomFactorNew == ZOOM_1_TO_16);
103}
104
105void TestZoomTransition::testOutBeforeFarthestFromEnum ()
106{
107 ZoomTransition zoomTransition;
108 ZoomFactor zoomFactorNew = zoomTransition.zoomOut (ZOOM_1_TO_1,
109 M11,
110 M22,
112
113 QVERIFY (zoomFactorNew == ZOOM_1_TO_1_FARTHER);
114}
115
116void TestZoomTransition::testOutBeforeFarthestFromFill ()
117{
118 ZoomTransition zoomTransition;
119 ZoomFactor zoomFactorNew = zoomTransition.zoomOut (ZOOM_FILL,
120 M11,
121 M22,
123
124 QVERIFY (zoomFactorNew == ZOOM_1_TO_1_CLOSER);
125}
void initializeLogging(const QString &name, const QString &filename, bool isDebug)
Definition Logger.cpp:21
const bool NO_EXPORT_ONLY
const QStringList NO_COMMAND_LINE
const QString NO_EXTRACT_IMAGE_EXTENSION
const QString NO_ERROR_REPORT_LOG_FILE
const bool NO_GNUPLOT_LOG_FILES
const QString NO_REGRESSION_OPEN_FILE
const QStringList NO_LOAD_STARTUP_FILES
const bool NO_REGRESSION_IMPORT
const bool NO_EXTRACT_IMAGE_ONLY
const bool NO_DROP_REGRESSION
const bool DEBUG_FLAG
const bool FILL_CHECKED
const bool FILL_UNCHECKED
const double M11
const double M22
ZoomFactor
Zoom factors ordered by zoom level so next one above/below is the next zoom level.
Definition ZoomFactor.h:11
@ ZOOM_1_TO_1_FARTHER
Definition ZoomFactor.h:25
@ ZOOM_2_TO_1
Definition ZoomFactor.h:21
@ ZOOM_FILL
Definition ZoomFactor.h:37
@ ZOOM_1_TO_1_CLOSER
Definition ZoomFactor.h:23
@ ZOOM_1_TO_1
Definition ZoomFactor.h:24
@ ZOOM_1_TO_16
Definition ZoomFactor.h:36
@ ZOOM_16_TO_1
Definition ZoomFactor.h:12
Unit test of ZoomTransition class.
TestZoomTransition(QObject *parent=0)
Single constructor.
ZoomFactor zoomOut(ZoomFactor currentZoomFactor, double m11, double m22, bool actionZoomFillIsChecked) const
Zoom out.
ZoomFactor zoomIn(ZoomFactor currentZoomFactor, double m11, double m22, bool actionZoomFillIsChecked) const
Zoom in.