tst_QTimeZone::stdCompatibility(): fix handling of unknown IDs
Follow-up to commit 69555b364d, 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>
bb10
parent
bf9f6791cd
commit
c464f67db4
|
|
@ -1859,18 +1859,10 @@ void tst_QTimeZone::stdCompatibility()
|
|||
QFETCH(const std::chrono::time_zone *, timeZone);
|
||||
QByteArrayView zoneName = QByteArrayView(timeZone->name());
|
||||
QTimeZone tz = QTimeZone::fromStdTimeZonePtr(timeZone);
|
||||
if (tz.isValid()) {
|
||||
if (tz.isValid())
|
||||
QCOMPARE(tz.id(), zoneName);
|
||||
} else {
|
||||
// QTBUG-102187: a few timezones reported by tzdb might not be
|
||||
// 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
|
||||
QVERIFY(!QTimeZone::isTimeZoneIdAvailable(zoneName.toByteArray()));
|
||||
#else
|
||||
QSKIP("This test requires C++20's <chrono>.");
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue