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 DEBUG_FLAG =
false;
30 const QStringList NO_LOAD_STARTUP_FILES;
32 initializeLogging (
"engauge_test",
37 NO_REGRESSION_OPEN_FILE,
42 NO_LOAD_STARTUP_FILES);
46 bool TestValidators::stateDateTime (
const QString &
string,
47 QValidator::State expectedState)
52 COORD_UNITS_DATE_YEAR_MONTH_DAY,
53 COORD_UNITS_TIME_HOUR_MINUTE_SECOND);
55 QString stringLocal = string;
56 return (validator.validate (stringLocal,
57 pos) == expectedState);
60 bool TestValidators::stateDegreesMinutesSeconds (
const QString &
string,
61 QValidator::State expectedState)
67 QString stringLocal = string;
68 return (validator.validate (stringLocal,
69 pos) == expectedState);
72 bool TestValidators::stateNumber(
const QString &
string,
73 QValidator::State expectedState)
81 QString stringLocal = string;
82 return (validator.validate (stringLocal,
83 pos) == expectedState);
86 void TestValidators::testDateTimeDate ()
88 QVERIFY (stateDateTime (
"2015/01/02", QValidator::Acceptable));
91 void TestValidators::testDateTimeDateTime ()
93 QVERIFY (stateDateTime (
"2015/01/02 01:02:03", QValidator::Acceptable));
96 void TestValidators::testDateTimeDateTimePm ()
98 QVERIFY (stateDateTime (
"2015/01/02 01:02:03 PM", QValidator::Acceptable));
101 void TestValidators::testDateTimeTime ()
103 QVERIFY (stateDateTime (
"01:02:03", QValidator::Acceptable));
106 void TestValidators::testDegreesMinutesSecondsDegrees ()
108 QVERIFY (stateDegreesMinutesSeconds (
"180", QValidator::Acceptable));
111 void TestValidators::testDegreesMinutesSecondsDegreesMinutes ()
113 QVERIFY (stateDegreesMinutesSeconds (
"180 10", QValidator::Acceptable));
116 void TestValidators::testDegreesMinutesSecondsDegreesMinutesSeconds ()
118 QVERIFY (stateDegreesMinutesSeconds (
"180 10 20", QValidator::Acceptable));
121 void TestValidators::testNumberInteger ()
123 QVERIFY (stateNumber (
"1", QValidator::Acceptable));
126 void TestValidators::testNumberReal ()
128 QVERIFY (stateNumber (
"1.1", QValidator::Acceptable));
131 void TestValidators::testNumberRealBad ()
133 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...