summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2021-01-08 13:48:51 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-02-03 11:28:21 +0000
commit083e9fbca268938eaba72af07309adf1d902613a (patch)
tree932b1e9e6ebd19b80c175d40175176c2b6e0cdef /tests
parent06c97d46e7b0857ab84b3f9bba49da80aee83cb9 (diff)
Correct string comparison in Android's IANA ID matching code
It used QString.compare() and assumed it was returning a bool true on equality, when it actually returns an int that compares to 0 as the given strings compare. So it should use compare() == 0. This fixes several of QTimeZone's blacklisted tests on Android and a crasher, which we dodged with a QSKIP. Added an id-comparison to a test. Gave two local variables more informative names, made an early return into a QSKIP so it explains itself. Fixes: QTBUG-89905 Fixes: QTBUG-69122 Fixes: QTBUG-69132 Fixes: QTBUG-87435 Change-Id: Icf18ed5a810143d6e65d36e34a70e82faac10b8e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit 6ee13db700eecd8dfed54a9ec2d1081b39511562) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/time/qtimezone/BLACKLIST4
-rw-r--r--tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp27
2 files changed, 11 insertions, 20 deletions
diff --git a/tests/auto/corelib/time/qtimezone/BLACKLIST b/tests/auto/corelib/time/qtimezone/BLACKLIST
index b820bab3d9..1f4811d4b8 100644
--- a/tests/auto/corelib/time/qtimezone/BLACKLIST
+++ b/tests/auto/corelib/time/qtimezone/BLACKLIST
@@ -1,7 +1,3 @@
-# QTBUG-69122
-[dataStreamTest]
-android
-
# QTBUG-69129
[specificTransition]
android
diff --git a/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp
index f2a56e3671..01559b85a9 100644
--- a/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp
+++ b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp
@@ -154,25 +154,23 @@ void tst_QTimeZone::printTimeZone(const QTimeZone &tz)
void tst_QTimeZone::createTest()
{
- QTimeZone tz("Pacific/Auckland");
+ const QTimeZone tz("Pacific/Auckland");
if (debug)
printTimeZone(tz);
// If the tz is not valid then skip as is probably using the UTC backend which is tested later
if (!tz.isValid())
- return;
-
- // Validity tests
- QCOMPARE(tz.isValid(), true);
+ QSKIP("System lacks zone used for test"); // This returns.
- // Comparison tests
- QTimeZone tz2("Pacific/Auckland");
- QTimeZone tz3("Australia/Sydney");
- QCOMPARE((tz == tz2), true);
- QCOMPARE((tz != tz2), false);
- QCOMPARE((tz == tz3), false);
- QCOMPARE((tz != tz3), true);
+ QCOMPARE(tz.id(), "Pacific/Auckland");
+ // Comparison tests:
+ const QTimeZone same("Pacific/Auckland");
+ QCOMPARE((tz == same), true);
+ QCOMPARE((tz != same), false);
+ const QTimeZone other("Australia/Sydney");
+ QCOMPARE((tz == other), false);
+ QCOMPARE((tz != other), true);
QCOMPARE(tz.country(), QLocale::NewZealand);
@@ -448,6 +446,7 @@ void tst_QTimeZone::utcOffsetId_data()
ROW("UTC+12:00", true, 43200);
ROW("UTC+13:00", true, 46800);
ROW("UTC+14:00", true, 50400);
+
// Windows IDs known to CLDR v35.1:
ROW("UTC-11", true, -39600);
ROW("UTC-09", true, -32400);
@@ -610,10 +609,6 @@ void tst_QTimeZone::transitionEachZone()
continue;
}
#endif
-#ifdef Q_OS_ANDROID
- if (zone == "America/Mazatlan" || zone == "Mexico/BajaSur")
- QSKIP("Crashes on Android, see QTBUG-69132");
-#endif
qint64 here = secs + i * 3600;
QDateTime when = QDateTime::fromMSecsSinceEpoch(here * 1000, named);
qint64 stamp = when.toMSecsSinceEpoch();