1 #include "CoordUnitsNonPolarTheta.h"
2 #include "DlgValidatorDateTime.h"
3 #include "DlgValidatorDegreesMinutesSeconds.h"
4 #include "DlgValidatorNumber.h"
6 #include "MainWindow.h"
7 #include <QtTest/QtTest>
8 #include "Test/TestValidators.h"
17 void TestValidators::cleanupTestCase ()
21 void TestValidators::initTestCase ()
23 const QString NO_ERROR_REPORT_LOG_FILE;
24 const QString NO_REGRESSION_OPEN_FILE;
25 const bool NO_GNUPLOT_LOG_FILES =
false;
26 const bool NO_REGRESSION_IMPORT =
false;
27 const bool NO_RESET =
false;
28 const bool NO_EXPORT_ONLY =
false;
29 const bool NO_EXTRACT_IMAGE_ONLY =
false;
30 const QString NO_EXTRACT_IMAGE_EXTENSION;
31 const bool DEBUG_FLAG =
false;
32 const QStringList NO_LOAD_STARTUP_FILES;
33 const QStringList NO_COMMAND_LINE;
35 initializeLogging (
"engauge_test",
40 NO_REGRESSION_OPEN_FILE,
45 NO_EXTRACT_IMAGE_ONLY,
46 NO_EXTRACT_IMAGE_EXTENSION,
47 NO_LOAD_STARTUP_FILES,
52 bool TestValidators::stateDateTime (
const QString &
string,
53 QValidator::State expectedState)
58 COORD_UNITS_DATE_YEAR_MONTH_DAY,
59 COORD_UNITS_TIME_HOUR_MINUTE_SECOND);
61 QString stringLocal = string;
62 return (validator.validate (stringLocal,
63 pos) == expectedState);
66 bool TestValidators::stateDegreesMinutesSeconds (
const QString &
string,
67 QValidator::State expectedState)
73 QString stringLocal = string;
74 return (validator.validate (stringLocal,
75 pos) == expectedState);
78 bool TestValidators::stateNumber(
const QString &
string,
79 QValidator::State expectedState)
87 QString stringLocal = string;
88 return (validator.validate (stringLocal,
89 pos) == expectedState);
92 void TestValidators::testDateTimeDate ()
94 QVERIFY (stateDateTime (
"2015/01/02", QValidator::Acceptable));
97 void TestValidators::testDateTimeDateTime ()
99 QVERIFY (stateDateTime (
"2015/01/02 01:02:03", QValidator::Acceptable));
102 void TestValidators::testDateTimeDateTimePm ()
104 QVERIFY (stateDateTime (
"2015/01/02 01:02:03 PM", QValidator::Acceptable));
107 void TestValidators::testDateTimeTime ()
109 QVERIFY (stateDateTime (
"01:02:03", QValidator::Acceptable));
112 void TestValidators::testDegreesMinutesSecondsDegrees ()
114 QVERIFY (stateDegreesMinutesSeconds (
"180", QValidator::Acceptable));
117 void TestValidators::testDegreesMinutesSecondsDegreesMinutes ()
119 QVERIFY (stateDegreesMinutesSeconds (
"180 10", QValidator::Acceptable));
122 void TestValidators::testDegreesMinutesSecondsDegreesMinutesSeconds ()
124 QVERIFY (stateDegreesMinutesSeconds (
"180 10 20", QValidator::Acceptable));
127 void TestValidators::testNumberInteger ()
129 QVERIFY (stateNumber (
"1", QValidator::Acceptable));
132 void TestValidators::testNumberReal ()
134 QVERIFY (stateNumber (
"1.1", QValidator::Acceptable));
137 void TestValidators::testNumberRealBad ()
139 QVERIFY (stateNumber (
"1.1.", QValidator::Invalid));
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...
Unit tests of validators.
Validator for generic (=simple) numbers.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...