tst_QTimeZone::stdCompatibility(): fix handling of unknown IDs
Follow-up to commit 69555b364d5f398dec2e66c1f969cf3bfdc44057, using QTimeZone::isTimeZoneIdAvailable() instead of trying to construct an ad-hoc test for known unknonwn zone IDs. Reopens: QTBUG-102187 Fixes: QTBUG-102187 Change-Id: I36ff4f1dfbc4035d73df5b8fd68376c1bc9641e1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
bf9f6791cd
commit
c464f67db4
@ -1859,18 +1859,10 @@ void tst_QTimeZone::stdCompatibility()
|
|||||||
QFETCH(const std::chrono::time_zone *, timeZone);
|
QFETCH(const std::chrono::time_zone *, timeZone);
|
||||||
QByteArrayView zoneName = QByteArrayView(timeZone->name());
|
QByteArrayView zoneName = QByteArrayView(timeZone->name());
|
||||||
QTimeZone tz = QTimeZone::fromStdTimeZonePtr(timeZone);
|
QTimeZone tz = QTimeZone::fromStdTimeZonePtr(timeZone);
|
||||||
if (tz.isValid()) {
|
if (tz.isValid())
|
||||||
QCOMPARE(tz.id(), zoneName);
|
QCOMPARE(tz.id(), zoneName);
|
||||||
} else {
|
else
|
||||||
// QTBUG-102187: a few timezones reported by tzdb might not be
|
QVERIFY(!QTimeZone::isTimeZoneIdAvailable(zoneName.toByteArray()));
|
||||||
// recognized by QTimeZone. This happens for instance on Windows, where
|
|
||||||
// tzdb is using ICU, whose database does not match QTimeZone's.
|
|
||||||
const bool isKnownUnknown =
|
|
||||||
!zoneName.contains('/')
|
|
||||||
|| zoneName == "Antarctica/Troll"
|
|
||||||
|| zoneName.startsWith("SystemV/");
|
|
||||||
QVERIFY(isKnownUnknown);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
QSKIP("This test requires C++20's <chrono>.");
|
QSKIP("This test requires C++20's <chrono>.");
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user