Engauge Digitizer
2
Loading...
Searching...
No Matches
Test
TestZoomTransition.cpp
Go to the documentation of this file.
1
#include "
Logger.h
"
2
#include "
MainWindow.h
"
3
#include <QtTest/QtTest>
4
#include "
Test/TestZoomTransition.h
"
5
#include "
ZoomTransition.h
"
6
7
QTEST_MAIN
(
TestZoomTransition
)
8
9
using namespace
std;
10
11
const
bool
FILL_CHECKED
=
true
;
12
const
bool
FILL_UNCHECKED
=
false
;
13
const
double
M11
= 1.9;
14
const
double
M22
= 1.49;
15
16
TestZoomTransition::TestZoomTransition
(QObject *
parent
) :
17
QObject(
parent
)
18
{
19
}
20
21
void
TestZoomTransition::cleanupTestCase ()
22
{
23
24
}
25
26
void
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"
,
43
DEBUG_FLAG
);
44
45
MainWindow
w
(
NO_ERROR_REPORT_LOG_FILE
,
46
NO_REGRESSION_OPEN_FILE
,
47
NO_DROP_REGRESSION
,
48
NO_REGRESSION_IMPORT
,
49
NO_GNUPLOT_LOG_FILES
,
50
NO_RESET
,
51
NO_EXPORT_ONLY
,
52
NO_EXTRACT_IMAGE_ONLY
,
53
NO_EXTRACT_IMAGE_EXTENSION
,
54
NO_LOAD_STARTUP_FILES
,
55
NO_COMMAND_LINE
);
56
w
.show ();
57
}
58
59
void
TestZoomTransition::testInAtClosestEnum ()
60
{
61
ZoomTransition
zoomTransition
;
62
ZoomFactor
zoomFactorNew
=
zoomTransition
.
zoomIn
(
ZOOM_16_TO_1
,
63
M11
,
64
M22
,
65
FILL_UNCHECKED
);
66
67
// Should be unchanged since cannot go further
68
QVERIFY
(
zoomFactorNew
==
ZOOM_16_TO_1
);
69
}
70
71
void
TestZoomTransition::testInBeforeClosestFromEnum ()
72
{
73
ZoomTransition
zoomTransition
;
74
ZoomFactor
zoomFactorNew
=
zoomTransition
.
zoomIn
(
ZOOM_1_TO_1
,
75
M11
,
76
M22
,
77
FILL_UNCHECKED
);
78
79
QVERIFY
(
zoomFactorNew
==
ZOOM_1_TO_1_CLOSER
);
80
}
81
82
void
TestZoomTransition::testInBeforeClosestFromFill ()
83
{
84
ZoomTransition
zoomTransition
;
85
ZoomFactor
zoomFactorNew
=
zoomTransition
.
zoomIn
(
ZOOM_FILL
,
86
M11
,
87
M22
,
88
FILL_CHECKED
);
89
90
QVERIFY
(
zoomFactorNew
==
ZOOM_2_TO_1
);
91
}
92
93
void
TestZoomTransition::testOutAtFarthestEnum ()
94
{
95
ZoomTransition
zoomTransition
;
96
ZoomFactor
zoomFactorNew
=
zoomTransition
.
zoomOut
(
ZOOM_1_TO_16
,
97
M11
,
98
M22
,
99
FILL_UNCHECKED
);
100
101
// Should be unchanged since cannot go further
102
QVERIFY
(
zoomFactorNew
==
ZOOM_1_TO_16
);
103
}
104
105
void
TestZoomTransition::testOutBeforeFarthestFromEnum ()
106
{
107
ZoomTransition
zoomTransition
;
108
ZoomFactor
zoomFactorNew
=
zoomTransition
.
zoomOut
(
ZOOM_1_TO_1
,
109
M11
,
110
M22
,
111
FILL_UNCHECKED
);
112
113
QVERIFY
(
zoomFactorNew
==
ZOOM_1_TO_1_FARTHER
);
114
}
115
116
void
TestZoomTransition::testOutBeforeFarthestFromFill ()
117
{
118
ZoomTransition
zoomTransition
;
119
ZoomFactor
zoomFactorNew
=
zoomTransition
.
zoomOut
(
ZOOM_FILL
,
120
M11
,
121
M22
,
122
FILL_CHECKED
);
123
124
QVERIFY
(
zoomFactorNew
==
ZOOM_1_TO_1_CLOSER
);
125
}
INNER_RADIUS_MIN
const int INNER_RADIUS_MIN
Definition
DlgSettingsDigitizeCurve.cpp:35
initializeLogging
void initializeLogging(const QString &name, const QString &filename, bool isDebug)
Definition
Logger.cpp:21
Logger.h
MainWindow.h
NO_EXPORT_ONLY
const bool NO_EXPORT_ONLY
Definition
TestExport.cpp:32
NO_COMMAND_LINE
const QStringList NO_COMMAND_LINE
Definition
TestExport.cpp:37
NO_EXTRACT_IMAGE_EXTENSION
const QString NO_EXTRACT_IMAGE_EXTENSION
Definition
TestExport.cpp:34
NO_ERROR_REPORT_LOG_FILE
const QString NO_ERROR_REPORT_LOG_FILE
Definition
TestExport.cpp:27
NO_GNUPLOT_LOG_FILES
const bool NO_GNUPLOT_LOG_FILES
Definition
TestExport.cpp:29
NO_REGRESSION_OPEN_FILE
const QString NO_REGRESSION_OPEN_FILE
Definition
TestExport.cpp:28
NO_LOAD_STARTUP_FILES
const QStringList NO_LOAD_STARTUP_FILES
Definition
TestExport.cpp:36
NO_REGRESSION_IMPORT
const bool NO_REGRESSION_IMPORT
Definition
TestExport.cpp:30
NO_EXTRACT_IMAGE_ONLY
const bool NO_EXTRACT_IMAGE_ONLY
Definition
TestExport.cpp:33
NO_DROP_REGRESSION
const bool NO_DROP_REGRESSION
Definition
TestExport.cpp:24
DEBUG_FLAG
const bool DEBUG_FLAG
Definition
TestExport.cpp:35
FILL_CHECKED
const bool FILL_CHECKED
Definition
TestZoomTransition.cpp:11
FILL_UNCHECKED
const bool FILL_UNCHECKED
Definition
TestZoomTransition.cpp:12
M11
const double M11
Definition
TestZoomTransition.cpp:13
M22
const double M22
Definition
TestZoomTransition.cpp:14
TestZoomTransition.h
ZoomFactor
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
@ ZOOM_1_TO_1_FARTHER
Definition
ZoomFactor.h:25
ZOOM_2_TO_1
@ ZOOM_2_TO_1
Definition
ZoomFactor.h:21
ZOOM_FILL
@ ZOOM_FILL
Definition
ZoomFactor.h:37
ZOOM_1_TO_1_CLOSER
@ ZOOM_1_TO_1_CLOSER
Definition
ZoomFactor.h:23
ZOOM_1_TO_1
@ ZOOM_1_TO_1
Definition
ZoomFactor.h:24
ZOOM_1_TO_16
@ ZOOM_1_TO_16
Definition
ZoomFactor.h:36
ZOOM_16_TO_1
@ ZOOM_16_TO_1
Definition
ZoomFactor.h:12
ZoomTransition.h
MainWindow
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition
MainWindow.h:92
TestZoomTransition
Unit test of ZoomTransition class.
Definition
TestZoomTransition.h:8
TestZoomTransition::TestZoomTransition
TestZoomTransition(QObject *parent=0)
Single constructor.
Definition
TestZoomTransition.cpp:16
ZoomTransition
Perform calculations to determine the next zoom setting given the current zoom setting,...
Definition
ZoomTransition.h:15
ZoomTransition::zoomOut
ZoomFactor zoomOut(ZoomFactor currentZoomFactor, double m11, double m22, bool actionZoomFillIsChecked) const
Zoom out.
Definition
ZoomTransition.cpp:87
ZoomTransition::zoomIn
ZoomFactor zoomIn(ZoomFactor currentZoomFactor, double m11, double m22, bool actionZoomFillIsChecked) const
Zoom in.
Definition
ZoomTransition.cpp:52
Generated on Wed Aug 3 2022 00:00:00 for Engauge Digitizer by
1.10.0