Use the modern name for zone Asia/Kolkatta

The old name Asia/Calcutta is being phased out. We can't assign
QTzTZP, so select between new name and old using a reference variable.
In the process, fix a QCOMPARE() against bool to a QVERIFY().

Pick-to: 6.5
Change-Id: I7cd8a813f8a88c8ae4ba07213f04f4ad0860cec0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c0cb616c1d62a90e612bd64d427f37ac11a5a473)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Edward Welbourne 2023-09-11 13:30:09 +02:00 committed by Qt Cherry-pick Bot
parent aa21d402d3
commit 2b253e4ef3

View File

@ -1274,7 +1274,7 @@ void tst_QTimeZone::tzTest()
// Test invalid constructor // Test invalid constructor
QTzTimeZonePrivate tzpi("Gondwana/Erewhon"); QTzTimeZonePrivate tzpi("Gondwana/Erewhon");
QCOMPARE(tzpi.isValid(), false); QVERIFY(!tzpi.isValid());
// Test named constructor // Test named constructor
QTzTimeZonePrivate tzp("Europe/Berlin"); QTzTimeZonePrivate tzp("Europe/Berlin");
@ -1441,9 +1441,12 @@ void tst_QTimeZone::tzTest()
QCOMPARE(datatz1.offsetFromUtc, datautc1.offsetFromUtc); QCOMPARE(datatz1.offsetFromUtc, datautc1.offsetFromUtc);
// Test TZ timezone vs UTC timezone for non-whole-hour positive offset: // Test TZ timezone vs UTC timezone for non-whole-hour positive offset:
QTzTimeZonePrivate tztz2("Asia/Calcutta"); QTzTimeZonePrivate tztz2k("Asia/Kolkata"); // New name
QTzTimeZonePrivate tztz2c("Asia/Calcutta"); // Legacy name
// Can't assign QtzTZP, so use a reference; prefer new name.
QTzTimeZonePrivate &tztz2 = tztz2k.isValid() ? tztz2k : tztz2c;
QUtcTimeZonePrivate tzutc2("UTC+05:30"); QUtcTimeZonePrivate tzutc2("UTC+05:30");
QVERIFY(tztz2.isValid()); QVERIFY2(tztz2.isValid(), tztz2.id().constData());
QVERIFY(tzutc2.isValid()); QVERIFY(tzutc2.isValid());
QTzTimeZonePrivate::Data datatz2 = tztz2.data(std); QTzTimeZonePrivate::Data datatz2 = tztz2.data(std);
QTzTimeZonePrivate::Data datautc2 = tzutc2.data(std); QTzTimeZonePrivate::Data datautc2 = tzutc2.data(std);