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 bool NO_GNUPLOT_LOG_FILES =
false;
25 const bool DEBUG_FLAG =
false;
27 initializeLogging (
"engauge_test",
32 NO_GNUPLOT_LOG_FILES);
36 bool TestValidators::stateDateTime (
const QString &
string,
37 QValidator::State expectedState)
42 COORD_UNITS_DATE_YEAR_MONTH_DAY,
43 COORD_UNITS_TIME_HOUR_MINUTE_SECOND);
45 QString stringLocal = string;
46 return (validator.validate (stringLocal,
47 pos) == expectedState);
50 bool TestValidators::stateDegreesMinutesSeconds (
const QString &
string,
51 QValidator::State expectedState)
57 QString stringLocal = string;
58 return (validator.validate (stringLocal,
59 pos) == expectedState);
62 bool TestValidators::stateNumber(
const QString &
string,
63 QValidator::State expectedState)
69 QString stringLocal = string;
70 return (validator.validate (stringLocal,
71 pos) == expectedState);
74 void TestValidators::testDateTimeDate ()
76 QVERIFY (stateDateTime (
"2015/01/02", QValidator::Acceptable));
79 void TestValidators::testDateTimeDateTime ()
81 QVERIFY (stateDateTime (
"2015/01/02 01:02:03", QValidator::Acceptable));
84 void TestValidators::testDateTimeDateTimePm ()
86 QVERIFY (stateDateTime (
"2015/01/02 01:02:03 PM", QValidator::Acceptable));
89 void TestValidators::testDateTimeTime ()
91 QVERIFY (stateDateTime (
"01:02:03", QValidator::Acceptable));
94 void TestValidators::testDegreesMinutesSecondsDegrees ()
96 QVERIFY (stateDegreesMinutesSeconds (
"180", QValidator::Acceptable));
99 void TestValidators::testDegreesMinutesSecondsDegreesMinutes ()
101 QVERIFY (stateDegreesMinutesSeconds (
"180 10", QValidator::Acceptable));
104 void TestValidators::testDegreesMinutesSecondsDegreesMinutesSeconds ()
106 QVERIFY (stateDegreesMinutesSeconds (
"180 10 20", QValidator::Acceptable));
109 void TestValidators::testNumberInteger ()
111 QVERIFY (stateNumber (
"1", QValidator::Acceptable));
114 void TestValidators::testNumberReal ()
116 QVERIFY (stateNumber (
"1.1", QValidator::Acceptable));
119 void TestValidators::testNumberRealBad ()
121 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...