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;
26 const QStringList NO_LOAD_STARTUP_FILES;
28 initializeLogging (
"engauge_test",
34 NO_LOAD_STARTUP_FILES);
38 bool TestValidators::stateDateTime (
const QString &
string,
39 QValidator::State expectedState)
44 COORD_UNITS_DATE_YEAR_MONTH_DAY,
45 COORD_UNITS_TIME_HOUR_MINUTE_SECOND);
47 QString stringLocal = string;
48 return (validator.validate (stringLocal,
49 pos) == expectedState);
52 bool TestValidators::stateDegreesMinutesSeconds (
const QString &
string,
53 QValidator::State expectedState)
59 QString stringLocal = string;
60 return (validator.validate (stringLocal,
61 pos) == expectedState);
64 bool TestValidators::stateNumber(
const QString &
string,
65 QValidator::State expectedState)
71 QString stringLocal = string;
72 return (validator.validate (stringLocal,
73 pos) == expectedState);
76 void TestValidators::testDateTimeDate ()
78 QVERIFY (stateDateTime (
"2015/01/02", QValidator::Acceptable));
81 void TestValidators::testDateTimeDateTime ()
83 QVERIFY (stateDateTime (
"2015/01/02 01:02:03", QValidator::Acceptable));
86 void TestValidators::testDateTimeDateTimePm ()
88 QVERIFY (stateDateTime (
"2015/01/02 01:02:03 PM", QValidator::Acceptable));
91 void TestValidators::testDateTimeTime ()
93 QVERIFY (stateDateTime (
"01:02:03", QValidator::Acceptable));
96 void TestValidators::testDegreesMinutesSecondsDegrees ()
98 QVERIFY (stateDegreesMinutesSeconds (
"180", QValidator::Acceptable));
101 void TestValidators::testDegreesMinutesSecondsDegreesMinutes ()
103 QVERIFY (stateDegreesMinutesSeconds (
"180 10", QValidator::Acceptable));
106 void TestValidators::testDegreesMinutesSecondsDegreesMinutesSeconds ()
108 QVERIFY (stateDegreesMinutesSeconds (
"180 10 20", QValidator::Acceptable));
111 void TestValidators::testNumberInteger ()
113 QVERIFY (stateNumber (
"1", QValidator::Acceptable));
116 void TestValidators::testNumberReal ()
118 QVERIFY (stateNumber (
"1.1", QValidator::Acceptable));
121 void TestValidators::testNumberRealBad ()
123 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...