From 93c97e040160809867589d5086dedca9a60f5b5d Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 7 Jan 2021 14:44:52 +0100 Subject: Correct #if-ery in QML locale's time-zone update test The feature check for timezone should apply to the whole test; it makes no sense without. The checks against Q_OS_WIN were redundant in code already subject to a Q_OS_UNIX check. Task-number: QTBUG-89889 Change-Id: I419a775bf0777379662aa19e5b0c81fd6e0e26f6 Reviewed-by: Ulf Hermann (cherry picked from commit 338ae625a350d1e471a4033f1bcc6e1bfa9c1690) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/qml/qqmllocale/tst_qqmllocale.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp index 7d0c10a702..822fe33b83 100644 --- a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp +++ b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp @@ -73,7 +73,7 @@ private slots: void dateTimeFormat(); void timeFormat_data(); void timeFormat(); -#if defined(Q_OS_UNIX) +#if defined(Q_OS_UNIX) && QT_CONFIG(timezone) void timeZoneUpdated(); #endif @@ -1276,7 +1276,7 @@ QString DateFormatter::getLocalizedForm(const QString &isoTimestamp) return locale.toString(input); } -#if defined(Q_OS_UNIX) +#if defined(Q_OS_UNIX) && QT_CONFIG(timezone) // Currently disabled on Windows as adjusting the timezone // requires additional privileges that aren't normally // enabled for a process. This can be achieved by calling @@ -1327,8 +1327,10 @@ void tst_qqmllocale::timeZoneUpdated() obj.reset(c.create()); QVERIFY(obj); -#if !defined(Q_OS_WIN) && QT_CONFIG(timezone) && (!defined(Q_OS_LINUX) || defined(Q_OS_ANDROID)) - QEXPECT_FAIL("", "Date.timeZoneUpdated() only works on non-Android Linux with QT_CONFIG(timezone).", Continue); +#if !defined(Q_OS_LINUX) || defined(Q_OS_ANDROID) + QEXPECT_FAIL("", + "Date.timeZoneUpdated() only works on non-Android Linux with QT_CONFIG(timezone).", + Continue); #endif QVERIFY(obj->property("success").toBool()); @@ -1337,12 +1339,14 @@ void tst_qqmllocale::timeZoneUpdated() QMetaObject::invokeMethod(obj.data(), "check"); -#if !defined(Q_OS_WIN) && QT_CONFIG(timezone) && (!defined(Q_OS_LINUX) || defined(Q_OS_ANDROID)) - QEXPECT_FAIL("", "Date.timeZoneUpdated() only works on non-Android Linux with QT_CONFIG(timezone).", Continue); +#if !defined(Q_OS_LINUX) || defined(Q_OS_ANDROID) + QEXPECT_FAIL("", + "Date.timeZoneUpdated() only works on non-Android Linux with QT_CONFIG(timezone).", + Continue); #endif QVERIFY(obj->property("success").toBool()); } -#endif +#endif // Unix && timezone QTEST_MAIN(tst_qqmllocale) -- cgit v1.2.3