summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@theqtcompany.com>2015-11-05 15:13:48 +0100
committerEdward Welbourne <edward.welbourne@theqtcompany.com>2016-01-20 17:11:33 +0000
commit722df6e0a2c640f09903f9b4f3b686c5c70e82d9 (patch)
treeb0716e08d5835ab9dbbd73796b3e720f95d8b2ff /tests/auto/corelib/tools
parent191858abe8cd2681f8f4e9de47819829bf1eaebb (diff)
Nomenclature corrections relating to CET.
There are several European time zones; the only one relevant to the tests here is CET. They won't work with WET, GMT or EET. So name them and related variables for CET, not for Europe. CET's summer-time isn't called CST; and the (existing) spring forward test works only in CET/CEST, not elsewhere in Europe. Change-Id: I55c7544bf792de7495700b749b935ec534831d8b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/tools')
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp74
1 files changed, 37 insertions, 37 deletions
diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
index 228ce73c6b..d8934c1604 100644
--- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
@@ -155,7 +155,7 @@ private slots:
private:
enum { LocalTimeIsUtc = 0, LocalTimeAheadOfUtc = 1, LocalTimeBehindUtc = -1} localTimeType;
- bool europeanTimeZone;
+ bool zoneIsCET;
QDate defDate() const { return QDate(1900, 1, 1); }
QTime defTime() const { return QTime(0, 0, 0); }
QDateTime defDateTime() const { return QDateTime(defDate(), defTime()); }
@@ -173,7 +173,7 @@ tst_QDateTime::tst_QDateTime()
{
uint x1 = QDateTime(QDate(1990, 1, 1), QTime()).toTime_t();
uint x2 = QDateTime(QDate(1990, 6, 1), QTime()).toTime_t();
- europeanTimeZone = (x1 == 631148400 && x2 == 644191200);
+ zoneIsCET = (x1 == 631148400 && x2 == 644191200);
QDateTime dt1 = QDateTime::fromTime_t(0);
QDateTime dt2 = QDateTime::fromTime_t(181 * 86400); // six months later, Jul 1
@@ -201,7 +201,7 @@ void tst_QDateTime::initTestCase()
break;
case LocalTimeAheadOfUtc:
typemsg1 = "ahead of";
- typemsg2 = europeanTimeZone ? "and is" : "but isn't";
+ typemsg2 = zoneIsCET ? "and is" : "but isn't";
break;
}
@@ -245,7 +245,7 @@ void tst_QDateTime::ctor()
QCOMPARE(dt3.timeSpec(), Qt::UTC);
QVERIFY(dt1 == dt2);
- if (europeanTimeZone) {
+ if (zoneIsCET) {
QVERIFY(dt1 != dt3);
QVERIFY(dt1 < dt3);
QVERIFY(dt1.addSecs(3600).toUTC() == dt3);
@@ -492,7 +492,7 @@ void tst_QDateTime::setTime_t()
dt1.setTime_t(123456);
QCOMPARE(dt1, QDateTime(QDate(1970, 1, 2), QTime(10, 17, 36), Qt::UTC));
- if (europeanTimeZone) {
+ if (zoneIsCET) {
QDateTime dt2;
dt2.setTime_t(123456);
QCOMPARE(dt2, QDateTime(QDate(1970, 1, 2), QTime(11, 17, 36), Qt::LocalTime));
@@ -500,7 +500,7 @@ void tst_QDateTime::setTime_t()
dt1.setTime_t((uint)(quint32)-123456);
QCOMPARE(dt1, QDateTime(QDate(2106, 2, 5), QTime(20, 10, 40), Qt::UTC));
- if (europeanTimeZone) {
+ if (zoneIsCET) {
QDateTime dt2;
dt2.setTime_t((uint)(quint32)-123456);
QCOMPARE(dt2, QDateTime(QDate(2106, 2, 5), QTime(21, 10, 40), Qt::LocalTime));
@@ -508,7 +508,7 @@ void tst_QDateTime::setTime_t()
dt1.setTime_t(1214567890);
QCOMPARE(dt1, QDateTime(QDate(2008, 6, 27), QTime(11, 58, 10), Qt::UTC));
- if (europeanTimeZone) {
+ if (zoneIsCET) {
QDateTime dt2;
dt2.setTime_t(1214567890);
QCOMPARE(dt2, QDateTime(QDate(2008, 6, 27), QTime(13, 58, 10), Qt::LocalTime));
@@ -516,7 +516,7 @@ void tst_QDateTime::setTime_t()
dt1.setTime_t(0x7FFFFFFF);
QCOMPARE(dt1, QDateTime(QDate(2038, 1, 19), QTime(3, 14, 7), Qt::UTC));
- if (europeanTimeZone) {
+ if (zoneIsCET) {
QDateTime dt2;
dt2.setTime_t(0x7FFFFFFF);
QCOMPARE(dt2, QDateTime(QDate(2038, 1, 19), QTime(4, 14, 7), Qt::LocalTime));
@@ -533,7 +533,7 @@ void tst_QDateTime::setMSecsSinceEpoch_data()
{
QTest::addColumn<qint64>("msecs");
QTest::addColumn<QDateTime>("utc");
- QTest::addColumn<QDateTime>("european");
+ QTest::addColumn<QDateTime>("cet");
QTest::newRow("zero")
<< Q_INT64_C(0)
@@ -584,7 +584,7 @@ void tst_QDateTime::setMSecsSinceEpoch()
{
QFETCH(qint64, msecs);
QFETCH(QDateTime, utc);
- QFETCH(QDateTime, european);
+ QFETCH(QDateTime, cet);
QDateTime dt;
dt.setTimeSpec(Qt::UTC);
@@ -595,8 +595,8 @@ void tst_QDateTime::setMSecsSinceEpoch()
QCOMPARE(dt.time(), utc.time());
QCOMPARE(dt.timeSpec(), Qt::UTC);
- if (europeanTimeZone) {
- QCOMPARE(dt.toLocalTime(), european);
+ if (zoneIsCET) {
+ QCOMPARE(dt.toLocalTime(), cet);
// Test converting from LocalTime to UTC back to LocalTime.
QDateTime localDt;
@@ -613,13 +613,13 @@ void tst_QDateTime::setMSecsSinceEpoch()
QDateTime dt2;
dt2.setTimeZone(europe);
dt2.setMSecsSinceEpoch(msecs);
- QCOMPARE(dt2.date(), european.date());
+ QCOMPARE(dt2.date(), cet.date());
// don't compare the time if the date is too early or too late: prior
// to 1916, timezones in Europe were not standardised and some OS APIs
// have hard limits. Let's restrict it to the 32-bit Unix range
if (dt2.date().year() >= 1970 && dt2.date().year() <= 2037)
- QCOMPARE(dt2.time(), european.time());
+ QCOMPARE(dt2.time(), cet.time());
QCOMPARE(dt2.timeSpec(), Qt::TimeZone);
QCOMPARE(dt2.timeZone(), europe);
}
@@ -643,7 +643,7 @@ void tst_QDateTime::fromMSecsSinceEpoch()
{
QFETCH(qint64, msecs);
QFETCH(QDateTime, utc);
- QFETCH(QDateTime, european);
+ QFETCH(QDateTime, cet);
QDateTime dtLocal = QDateTime::fromMSecsSinceEpoch(msecs, Qt::LocalTime);
QDateTime dtUtc = QDateTime::fromMSecsSinceEpoch(msecs, Qt::UTC);
@@ -665,10 +665,10 @@ void tst_QDateTime::fromMSecsSinceEpoch()
if (msecs != std::numeric_limits<qint64>::max())
QCOMPARE(dtOffset.time(), utc.time().addMSecs(60*60*1000));
- if (europeanTimeZone) {
- QCOMPARE(dtLocal.toLocalTime(), european);
- QCOMPARE(dtUtc.toLocalTime(), european);
- QCOMPARE(dtOffset.toLocalTime(), european);
+ if (zoneIsCET) {
+ QCOMPARE(dtLocal.toLocalTime(), cet);
+ QCOMPARE(dtUtc.toLocalTime(), cet);
+ QCOMPARE(dtOffset.toLocalTime(), cet);
} else {
QSKIP("You must test using Central European (CET/CEST) time zone, e.g. TZ=Europe/Oslo");
}
@@ -793,7 +793,7 @@ void tst_QDateTime::toString_rfcDate_data()
QTest::addColumn<QDateTime>("dt");
QTest::addColumn<QString>("formatted");
- if (europeanTimeZone) {
+ if (zoneIsCET) {
QTest::newRow("localtime")
<< QDateTime(QDate(1978, 11, 9), QTime(13, 28, 34))
<< QString("09 Nov 1978 13:28:34 +0100");
@@ -1050,7 +1050,7 @@ void tst_QDateTime::addSecs_data()
QTest::newRow("utc9") << QDateTime(QDate(4000, 1, 1), standardTime, Qt::UTC) << 0
<< QDateTime(QDate(4000, 1, 1), standardTime, Qt::UTC);
- if (europeanTimeZone) {
+ if (zoneIsCET) {
QTest::newRow("cet0") << QDateTime(QDate(2004, 1, 1), standardTime, Qt::LocalTime) << 86400
<< QDateTime(QDate(2004, 1, 2), standardTime, Qt::LocalTime);
QTest::newRow("cet1") << QDateTime(QDate(2004, 1, 1), standardTime, Qt::LocalTime) << (86400 * 185)
@@ -1162,7 +1162,7 @@ void tst_QDateTime::toTimeSpec_data()
<< QDateTime(QDate(-271821, 4, 20), QTime(23, 0, 0), Qt::UTC)
<< QDateTime(QDate(-271821, 4, 21), QTime(0, 0, 0), Qt::LocalTime);
- if (europeanTimeZone) {
+ if (zoneIsCET) {
QTest::newRow("summer1") << QDateTime(QDate(2004, 6, 30), utcTime, Qt::UTC)
<< QDateTime(QDate(2004, 6, 30), localDaylightTime, Qt::LocalTime);
QTest::newRow("summer2") << QDateTime(QDate(1760, 6, 30), utcTime, Qt::UTC)
@@ -1185,7 +1185,7 @@ void tst_QDateTime::toTimeSpec_data()
void tst_QDateTime::toTimeSpec()
{
- if (europeanTimeZone) {
+ if (zoneIsCET) {
QFETCH(QDateTime, fromUtc);
QFETCH(QDateTime, fromLocal);
@@ -1240,7 +1240,7 @@ void tst_QDateTime::toTimeSpec()
QCOMPARE(localToOffset.time(), fromUtc.time());
QCOMPARE(localToOffset.timeSpec(), Qt::UTC);
} else {
- QSKIP("Not tested with timezone other than Central European (CET/CST)");
+ QSKIP("Not tested with timezone other than Central European (CET/CEST)");
}
}
@@ -1251,7 +1251,7 @@ void tst_QDateTime::toLocalTime_data()
void tst_QDateTime::toLocalTime()
{
- if (europeanTimeZone) {
+ if (zoneIsCET) {
QFETCH(QDateTime, fromUtc);
QFETCH(QDateTime, fromLocal);
@@ -1262,7 +1262,7 @@ void tst_QDateTime::toLocalTime()
QCOMPARE(fromUtc.toLocalTime(), fromLocal);
QCOMPARE(fromUtc.toLocalTime(), fromLocal.toLocalTime());
} else {
- QSKIP("Not tested with timezone other than Central European (CET/CST)");
+ QSKIP("Not tested with timezone other than Central European (CET/CEST)");
}
}
@@ -1273,7 +1273,7 @@ void tst_QDateTime::toUTC_data()
void tst_QDateTime::toUTC()
{
- if (europeanTimeZone) {
+ if (zoneIsCET) {
QFETCH(QDateTime, fromUtc);
QFETCH(QDateTime, fromLocal);
@@ -1284,7 +1284,7 @@ void tst_QDateTime::toUTC()
QCOMPARE(fromLocal.toUTC(), fromUtc);
QCOMPARE(fromUtc.toUTC(), fromLocal.toUTC());
} else {
- QSKIP("Not tested with timezone other than Central European (CET/CST)");
+ QSKIP("Not tested with timezone other than Central European (CET/CEST)");
}
QDateTime dt = QDateTime::currentDateTime();
@@ -1614,9 +1614,9 @@ void tst_QDateTime::springForward_data()
QTest::addColumn<int>("step"); // days to step; +ve from before, -ve from after
QTest::addColumn<int>("adjust"); // minutes ahead of UTC on day stepped from
- if (europeanTimeZone) {
- QTest::newRow("Europe from day before") << QDate(2015, 3, 29) << QTime(2, 30, 0) << 1 << 60;
- QTest::newRow("Europe from day after") << QDate(2015, 3, 29) << QTime(2, 30, 0) << -1 << 120;
+ if (zoneIsCET) {
+ QTest::newRow("CET from day before") << QDate(2015, 3, 29) << QTime(2, 30, 0) << 1 << 60;
+ QTest::newRow("CET from day after") << QDate(2015, 3, 29) << QTime(2, 30, 0) << -1 << 120;
// } else if (otherZone) {
} else {
QSKIP("No spring forward test data for this TZ");
@@ -1687,7 +1687,7 @@ void tst_QDateTime::operator_eqeq_data()
QTest::newRow("invalid == invalid") << invalidDateTime() << invalidDateTime() << true << false;
QTest::newRow("invalid == valid #1") << invalidDateTime() << dateTime1 << false << false;
- if (europeanTimeZone) {
+ if (zoneIsCET) {
QTest::newRow("data14") << QDateTime(QDate(2004, 1, 2), QTime(2, 2, 3), Qt::LocalTime)
<< QDateTime(QDate(2004, 1, 2), QTime(1, 2, 3), Qt::UTC) << true << true;
}
@@ -1719,7 +1719,7 @@ void tst_QDateTime::operator_eqeq()
if (equal)
QVERIFY(qHash(dt1) == qHash(dt2));
- if (checkEuro && europeanTimeZone) {
+ if (checkEuro && zoneIsCET) {
QVERIFY(dt1.toUTC() == dt2);
QVERIFY(dt1 == dt2.toLocalTime());
}
@@ -2233,7 +2233,7 @@ void tst_QDateTime::offsetFromUtc()
QCOMPARE(dt2.offsetFromUtc(), 0);
// LocalTime should vary
- if (europeanTimeZone) {
+ if (zoneIsCET) {
// Time definitely in Standard Time so 1 hour ahead
QDateTime dt3(QDate(2013, 1, 1), QTime(0, 0, 0), Qt::LocalTime);
QCOMPARE(dt3.offsetFromUtc(), 1 * 60 * 60);
@@ -2358,7 +2358,7 @@ void tst_QDateTime::timeZoneAbbreviation()
QCOMPARE(dt3.timeZoneAbbreviation(), QString("UTC"));
// LocalTime should vary
- if (europeanTimeZone) {
+ if (zoneIsCET) {
// Time definitely in Standard Time
QDateTime dt4(QDate(2013, 1, 1), QTime(0, 0, 0), Qt::LocalTime);
#ifdef Q_OS_WIN
@@ -2482,7 +2482,7 @@ void tst_QDateTime::isDaylightTime() const
QDateTime offset2(QDate(2012, 6, 1), QTime(0, 0, 0), Qt::OffsetFromUTC, 1 * 60 * 60);
QVERIFY(!offset2.isDaylightTime());
- if (europeanTimeZone) {
+ if (zoneIsCET) {
QDateTime cet1(QDate(2012, 1, 1), QTime(0, 0, 0));
QVERIFY(!cet1.isDaylightTime());
QDateTime cet2(QDate(2012, 6, 1), QTime(0, 0, 0));
@@ -2494,7 +2494,7 @@ void tst_QDateTime::isDaylightTime() const
void tst_QDateTime::daylightTransitions() const
{
- if (europeanTimeZone) {
+ if (zoneIsCET) {
// CET transitions occur at 01:00:00 UTC on last Sunday in March and October
// 2011-03-27 02:00:00 CET became 03:00:00 CEST at msecs = 1301187600000
// 2011-10-30 03:00:00 CEST became 02:00:00 CET at msecs = 1319936400000