summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2021-01-07 14:44:52 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-01-08 13:32:14 +0000
commit93c97e040160809867589d5086dedca9a60f5b5d (patch)
tree1c7e01b9cdbe6322a389a20bf9a087765f0b4eea
parent585ca9de9dec2d85e7e7c9ebd3577dd0c7ec6854 (diff)
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 <ulf.hermann@qt.io> (cherry picked from commit 338ae625a350d1e471a4033f1bcc6e1bfa9c1690) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--tests/auto/qml/qqmllocale/tst_qqmllocale.cpp18
1 files 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)