tst_QLocale: base europeanTimeZone test on 2013, actually used in test

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 <marten.nordheim@qt.io>
This commit is contained in:
Edward Welbourne 2023-10-24 15:44:24 +02:00
parent a3f1b8e4d9
commit 887e18990d

View File

@ -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>("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()