From 057329c24c00047c8c3e1502a9a8dfa9a4169481 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 23 Jun 2020 12:40:55 +0200 Subject: Make feature datetimeparser depend on feature datestring MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tests/auto/corelib/time/qtime/tst_qtime.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/auto/corelib/time/qtime/tst_qtime.cpp') 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 #include #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("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() { -- cgit v1.2.3