Engauge Digitizer 2
Loading...
Searching...
No Matches
TestValidators.cpp
Go to the documentation of this file.
5#include "Logger.h"
6#include "MainWindow.h"
7#include <QtTest/QtTest>
9
11
13 QObject(parent)
14{
15}
16
17void TestValidators::cleanupTestCase ()
18{
19}
20
21void TestValidators::initTestCase ()
22{
23 const bool NO_DROP_REGRESSION = false;
26 const bool NO_GNUPLOT_LOG_FILES = false;
27 const bool NO_REGRESSION_IMPORT = false;
28 const bool NO_RESET = false;
29 const bool NO_EXPORT_ONLY = false;
30 const bool NO_EXTRACT_IMAGE_ONLY = false;
32 const bool DEBUG_FLAG = false;
35
36 initializeLogging ("engauge_test",
37 "engauge_test.log",
39
51 w.show ();
52}
53
54bool TestValidators::stateDateTime (const QString &string,
55 QValidator::State expectedState)
56{
57 int pos;
58
62
64 return (validator.validate (stringLocal,
65 pos) == expectedState);
66}
67
68bool TestValidators::stateDegreesMinutesSeconds (const QString &string,
69 QValidator::State expectedState)
70{
71 int pos;
72
74
76 return (validator.validate (stringLocal,
77 pos) == expectedState);
78}
79
80bool TestValidators::stateNumber(const QString &string,
81 QValidator::State expectedState)
82{
83 int pos;
84 const QLocale locale;
85
87 locale);
88
90 return (validator.validate (stringLocal,
91 pos) == expectedState);
92}
93
94void TestValidators::testDateTimeDate ()
95{
96 QVERIFY (stateDateTime ("2015/01/02", QValidator::Acceptable));
97}
98
99void TestValidators::testDateTimeDateTime ()
100{
101 QVERIFY (stateDateTime ("2015/01/02 01:02:03", QValidator::Acceptable));
102}
103
104void TestValidators::testDateTimeDateTimePm ()
105{
106 QVERIFY (stateDateTime ("2015/01/02 01:02:03 PM", QValidator::Acceptable));
107}
108
109void TestValidators::testDateTimeTime ()
110{
111 QVERIFY (stateDateTime ("01:02:03", QValidator::Acceptable));
112}
113
114void TestValidators::testDegreesMinutesSecondsDegrees ()
115{
116 QVERIFY (stateDegreesMinutesSeconds ("180", QValidator::Acceptable));
117}
118
119void TestValidators::testDegreesMinutesSecondsDegreesMinutes ()
120{
121 QVERIFY (stateDegreesMinutesSeconds ("180 10", QValidator::Acceptable));
122}
123
124void TestValidators::testDegreesMinutesSecondsDegreesMinutesSeconds ()
125{
126 QVERIFY (stateDegreesMinutesSeconds ("180 10 20", QValidator::Acceptable));
127}
128
129void TestValidators::testNumberInteger ()
130{
131 QVERIFY (stateNumber ("1", QValidator::Acceptable));
132}
133
134void TestValidators::testNumberReal ()
135{
136 QVERIFY (stateNumber ("1.1", QValidator::Acceptable));
137}
138
139void TestValidators::testNumberRealBad ()
140{
141 QVERIFY (stateNumber ("1.1.", QValidator::Invalid));
142}
@ COORD_SCALE_LOG
Definition CoordScale.h:14
@ COORD_UNITS_DATE_YEAR_MONTH_DAY
@ COORD_UNITS_TIME_HOUR_MINUTE_SECOND
const int INNER_RADIUS_MIN
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
Validator for numeric value expressed as date and/or time.
Validator for angles in real degrees, integer degrees and real minutes, or integer degrees with integ...
Validator for generic (=simple) numbers.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition MainWindow.h:92
Unit tests of validators.