From aeec731262bf981f90760d477966cea5f1621ea1 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 26 Apr 2023 13:41:25 +0200 Subject: [PATCH] Correct startOfDay_endOfDay:BajaMexico test case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This follows up on commit ca4aa065230d3524479f4a5cdbc077d11cc62e5d with a correction to the start of day, which should of course be 01:00, not invalid. Unsurprisingly, the MS backend doesn't know anything about that, so gets this wrong; kludge round it. In the process, adapt the kludge to the Sofia test-case to work the same way. Change-Id: If18e6d005783a0854c56092e695177898ec61712 Reviewed-by: MÃ¥rten Nordheim --- tests/auto/corelib/time/qdate/tst_qdate.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/auto/corelib/time/qdate/tst_qdate.cpp b/tests/auto/corelib/time/qdate/tst_qdate.cpp index 3c280ca1595..75574d78657 100644 --- a/tests/auto/corelib/time/qdate/tst_qdate.cpp +++ b/tests/auto/corelib/time/qdate/tst_qdate.cpp @@ -14,6 +14,10 @@ using namespace QtPrivate::DateTimeConstants; +#if defined(Q_OS_WIN) && !QT_CONFIG(icu) +# define USING_WIN_TZ +#endif + class tst_QDate : public QObject { Q_OBJECT @@ -510,7 +514,12 @@ void tst_QDate::startOfDay_endOfDay_data() // The western Mexico time-zones skipped the first hour of 1970. QTest::newRow("BajaMexico") << QDate(1970, 1, 1) << QByteArray("America/Hermosillo") - << invalid << late; +#ifdef USING_WIN_TZ // MS's TZ APIs lack data + << invalid +#else + << QTime(1, 0) +#endif + << late; } if (QTimeZone("America/Sao_Paulo").isValid()) { QTest::newRow("Brazil") @@ -519,18 +528,21 @@ void tst_QDate::startOfDay_endOfDay_data() // Several South American zones coincide, see // tst_QDateTime::fromStringDateFormat(ISO 24:00 in DST). } -#if QT_CONFIG(icu) || !defined(Q_OS_WIN) // MS's TZ APIs lack data if (QTimeZone("Europe/Sofia").isValid()) { // Several southern zones within EET (but not the northern ones) spent // part of the 1990s using midnight as spring transition. These included // Asia/{Beirut,Famagusta,Nicosia} and Europe/{Bucharest,Chisinau,Nicosia}. QTest::newRow("Sofia") << QDate(1994, 3, 27) << QByteArray("Europe/Sofia") - << QTime(1, 0) << late; +#ifdef USING_WIN_TZ // MS's TZ APIs lack data + << invalid +#else + << QTime(1, 0) +#endif + << late; // Additionally, America/Scoresbysund, Atlantic/Azores, // Asia/{Choibalsan,Hovd,Tbilisi,Ulan_Bator,Ulaanbaatar} coincide. } -#endif if (QTimeZone("Pacific/Kiritimati").isValid()) { QTest::newRow("Kiritimati") << QDate(1994, 12, 31) << QByteArray("Pacific/Kiritimati")