diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2023-03-24 14:30:45 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2023-04-20 15:17:27 +0200 |
commit | fac656720801f74e8cacd8070fe7e55db58d2ecd (patch) | |
tree | 93cc2d6856bbb6075b5b1984f25231e71135df91 /tests/auto/corelib/time | |
parent | cb54fa634a380a6e4ed6bd501001eb95b4755435 (diff) |
tst_QDateTime: cope with MET masquerading as CET
MET is an alias for CET, so the test's attempts to detect whether it's
in CET can't distinguish them other than by checking the abbreviation.
Change-Id: Ibb467d9bb2d983ca16302111b54f664a614057c2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/time')
-rw-r--r-- | tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp index 37b237e7eb..ea9d161f74 100644 --- a/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp @@ -3465,16 +3465,34 @@ void tst_QDateTime::timeZoneAbbreviation() if (zoneIsCET) { // Time definitely in Standard Time QDateTime dt4 = QDate(2013, 1, 1).startOfDay(); + /* Note that MET is functionally an alias for CET (their zoneinfo files + differ only in the first letter of the abbreviations), unlike the + various zones that give CET as their abbreviation. + */ + { + const auto abbrev = dt4.timeZoneAbbreviation(); + auto reporter = qScopeGuard([abbrev]() { + qDebug() << "Unexpected abbreviation" << abbrev; + }); #ifdef Q_OS_WIN - QEXPECT_FAIL("", "Windows only reports long name (QTBUG-32759)", Continue); + QEXPECT_FAIL("", "Windows only reports long name (QTBUG-32759)", Continue); #endif - QCOMPARE(dt4.timeZoneAbbreviation(), QStringLiteral("CET")); + QVERIFY(abbrev == u"CET"_s || abbrev == u"MET"_s); + reporter.dismiss(); + } // Time definitely in Daylight Time QDateTime dt5 = QDate(2013, 6, 1).startOfDay(); + { + const auto abbrev = dt5.timeZoneAbbreviation(); + auto reporter = qScopeGuard([abbrev]() { + qDebug() << "Unexpected abbreviation" << abbrev; + }); #ifdef Q_OS_WIN - QEXPECT_FAIL("", "Windows only reports long name (QTBUG-32759)", Continue); + QEXPECT_FAIL("", "Windows only reports long name (QTBUG-32759)", Continue); #endif - QCOMPARE(dt5.timeZoneAbbreviation(), QStringLiteral("CEST")); + QVERIFY(abbrev == u"CEST"_s || abbrev == u"MEST"_s); + reporter.dismiss(); + } } else { qDebug("(Skipped some CET-only tests)"); } |