aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2022-05-06 11:39:35 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-05-17 19:04:59 +0000
commit2a1d582d69d9d3264f27ad5b573ba38cf2f4fd07 (patch)
tree8d55a8d37b7dbdd1cd63a9964044c00dcf93c670
parentf6027468d164bd273aefdf641d73d63821b50416 (diff)
tst_qqmlqt: fix TimeZoneSwitch logic
The TimeZoneSwitch class was setting the doChangeZone flag incorrectly, so it was actually trying to change the zone only for "localtime". This patch fixes the issue. With this fix applied, the test started failing on some OS that fail to change local timezone, so skip such input data for these configurations. Fixes: QTBUG-100014 Change-Id: If39a15fe1008211a940174fdc3aa5209df34c115 Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit c9013be2d9dcfe710932ec2f2c0e765a893e68f0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--tests/auto/qml/qqmlqt/BLACKLIST3
-rw-r--r--tests/auto/qml/qqmlqt/tst_qqmlqt.cpp10
2 files changed, 5 insertions, 8 deletions
diff --git a/tests/auto/qml/qqmlqt/BLACKLIST b/tests/auto/qml/qqmlqt/BLACKLIST
deleted file mode 100644
index 576c468806..0000000000
--- a/tests/auto/qml/qqmlqt/BLACKLIST
+++ /dev/null
@@ -1,3 +0,0 @@
-# QTBUG-100014
-[timeRoundtrip]
-android
diff --git a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp
index e97ab543d1..60a4c808c7 100644
--- a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp
+++ b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp
@@ -1369,7 +1369,7 @@ class TimeZoneSwitch
{
public:
TimeZoneSwitch(const char *newZone)
- : doChangeZone(qstrcmp(newZone, "localtime") == 0)
+ : doChangeZone(qstrcmp(newZone, "localtime") != 0)
{
if (!doChangeZone)
return;
@@ -1407,6 +1407,9 @@ void tst_qqmlqt::timeRoundtrip_data()
// Local timezone:
QTest::newRow("localtime") << QTime(0, 0, 0);
+#if defined(Q_OS_WIN) || defined(Q_OS_ANDROID) || defined(Q_OS_MACOS)
+ qInfo("Omitting the tests that depend on setting local time's zone");
+#else
// No DST:
QTest::newRow("UTC") << QTime(0, 0, 0);
QTest::newRow("Europe/Amsterdam") << QTime(1, 0, 0);
@@ -1418,14 +1421,11 @@ void tst_qqmlqt::timeRoundtrip_data()
QTest::newRow("Australia/Hobart") << QTime(10, 0, 0);
QTest::newRow("Pacific/Auckland") << QTime(12, 0, 0);
QTest::newRow("Pacific/Samoa") << QTime(13, 0, 0);
+#endif
}
void tst_qqmlqt::timeRoundtrip()
{
-#ifdef Q_OS_WIN
- QSKIP("On Windows, the DateObject doesn't handle DST transitions correctly when the timezone is not localtime."); // I.e.: for this test.
-#endif
-
TimeZoneSwitch tzs(QTest::currentDataTag());
QFETCH(QTime, time);
qmlRegisterTypesAndRevisions<TimeProvider>("Test", 1);