From 887e18990d40c8ffbaf4764b648a96325a2a910f Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 24 Oct 2023 15:44:24 +0200 Subject: [PATCH] tst_QLocale: base europeanTimeZone test on 2013, actually used in test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test that needs this bool is using 2013, so test that year for a match. (Africa/Tunis toyed with DST in 1990, the year used before, but thought better of it.) In the process, move the initialization to the member-initialization of the class and make the member const. Change-Id: Ib87636cdb0b038fad0cdef9fbe49e96f7bf79d1f Reviewed-by: MÃ¥rten Nordheim --- tests/auto/corelib/text/qlocale/tst_qlocale.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp index 469e2d6333..53b4f10447 100644 --- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp @@ -163,20 +163,19 @@ private: QString m_decimal, m_thousand, m_sdate, m_ldate, m_time; QString m_sysapp; QStringList cleanEnv; - bool europeanTimeZone; + const bool europeanTimeZone; void toReal_data(); using TransientLocale = QTestLocaleChange::TransientLocale; }; tst_QLocale::tst_QLocale() + // Some tests are specific to CET, test if it applies: + : europeanTimeZone( + QDate(2013, 1, 1).startOfDay().offsetFromUtc() == 3600 + && QDate(2013, 6, 1).startOfDay().offsetFromUtc() == 7200) { qRegisterMetaType("QLocale::FormatType"); - - // Test if in Central European Time zone - uint x1 = QDateTime(QDate(1990, 1, 1), QTime()).toSecsSinceEpoch(); - uint x2 = QDateTime(QDate(1990, 6, 1), QTime()).toSecsSinceEpoch(); - europeanTimeZone = (x1 == 631148400 && x2 == 644191200); } void tst_QLocale::initTestCase()