summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/text/qlocale
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2023-10-24 15:44:24 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2023-10-25 18:32:06 +0200
commit887e18990d40c8ffbaf4764b648a96325a2a910f (patch)
tree36182fa3717114c3a298d8729d2274acf0fd41cd /tests/auto/corelib/text/qlocale
parenta3f1b8e4d9e24cca4ed2eca2da19b69ff42bbbbc (diff)
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>
Diffstat (limited to 'tests/auto/corelib/text/qlocale')
-rw-r--r--tests/auto/corelib/text/qlocale/tst_qlocale.cpp11
1 files 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>("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()