From fac656720801f74e8cacd8070fe7e55db58d2ecd Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 24 Mar 2023 14:30:45 +0100 Subject: [PATCH] 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 --- .../corelib/time/qdatetime/tst_qdatetime.cpp | 26 ++++++++++++++++--- 1 file 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)"); }