diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2020-06-23 12:40:55 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2020-07-02 15:35:18 +0200 |
commit | 057329c24c00047c8c3e1502a9a8dfa9a4169481 (patch) | |
tree | 307ed9e68e004dad434aa7c5a140f56ae0391bcc /tests/auto/corelib/time/qtime/tst_qtime.cpp | |
parent | c30e0c656f34815f7ba5fac33ce58baa421c4289 (diff) |
Make feature datetimeparser depend on feature datestring
No client of QDateTimeParser actually uses it unless datestring was
enabled, nor is it any use without datestring. Various methods
conditioned on datestring are broken unless datetimeparser is enabled.
We can't condition public API on datetimeparser, as it's a private
feature, but client code can condition use of it on the private
feature. All string-to-date/time conversions that use a string format
(this includes all locale-specific formats) depend on feature
datetimeparser.
Change #if-ery (or add it) in all client (including test) code to test
the right feature.
Tidied up some code in the process. Killed some already-redundant
textdate #if-ery. Renamed a test whose name claimed it involved
locale, which it doesn't, in the course of #if-ing it.
This simplifies the condition for feature datetimeedit (which overtly
depended on textdate, redundantly since it depends on datestring which
depends on textdate; its dependence on datetimeparser now makes its
dependency on datestring also redundant).
It also removes the need for assorted datestring checks in
QDateTimeParser itself.
Change-Id: I5dfe3a977042134b2cfb16cbcc795070634e7adf
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'tests/auto/corelib/time/qtime/tst_qtime.cpp')
-rw-r--r-- | tests/auto/corelib/time/qtime/tst_qtime.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/corelib/time/qtime/tst_qtime.cpp b/tests/auto/corelib/time/qtime/tst_qtime.cpp index 764b2b8351..eaa90971f2 100644 --- a/tests/auto/corelib/time/qtime/tst_qtime.cpp +++ b/tests/auto/corelib/time/qtime/tst_qtime.cpp @@ -26,6 +26,7 @@ ** ****************************************************************************/ +#include <private/qglobal_p.h> #include <QtTest/QtTest> #include "qdatetime.h" #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) @@ -57,14 +58,18 @@ private Q_SLOTS: void operator_gt(); void operator_lt_eq(); void operator_gt_eq(); +#if QT_CONFIG(datestring) +# if QT_CONFIG(datetimeparser) void fromStringFormat_data(); void fromStringFormat(); +# endif void fromStringDateFormat_data(); void fromStringDateFormat(); void toStringDateFormat_data(); void toStringDateFormat(); void toStringFormat_data(); void toStringFormat(); +#endif void msecsSinceStartOfDay_data(); void msecsSinceStartOfDay(); @@ -530,6 +535,8 @@ void tst_QTime::operator_gt_eq() QVERIFY( t1 >= t2 ); } +#if QT_CONFIG(datestring) +# if QT_CONFIG(datetimeparser) void tst_QTime::fromStringFormat_data() { QTest::addColumn<QString>("string"); @@ -562,6 +569,7 @@ void tst_QTime::fromStringFormat() QTime dt = QTime::fromString(string, format); QCOMPARE(dt, expected); } +# endif // datetimeparser void tst_QTime::fromStringDateFormat_data() { @@ -750,6 +758,7 @@ void tst_QTime::toStringFormat() QCOMPARE( t.toString( format ), str ); } +#endif // datestring void tst_QTime::msecsSinceStartOfDay_data() { |