diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2016-10-28 17:24:46 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2018-12-07 16:50:57 +0000 |
commit | 24af53cfeb998dcf3a6c6d49d312e50809a4a324 (patch) | |
tree | 62c7b94bc8ec2fa88521e06c59b1b3708d34f499 /tests | |
parent | 93c3844a84f0acd382be5021d2ebe896269b7277 (diff) |
V4 Date: fix what we can within ECMA 262's limitations
Use QDateTime and QTimeZone to simplify code (when we can).
Note which defective methods are so because the ECMAScript spec
requires those defects, reference my bug report against those defects.
Fix currentTime to return a UTC time.
Fix getLocalTZA to actually deliver the standard offset, without
daylight-saving corrections.
Fix DaylightSavingTA(t) to return the difference between current
standard time offset and pertinent total offset at time t (explaining
why that's the least broken answer), rather than assuming DST is one
hour when active. (In some places it's half an hour, in some places
two hours; and the bugs in the spec break UTC() and LocalTime() if we
only return actual DST offset, without adjusting for historical
changes to standard offset.)
Fix tests to use actual IANA IDs for zones.
Change QTime-to-Time conversion to use a modernish date, for which
time-zone data is likely to at least be consistently handled, instead
of MakeDay(0, 0, 0); that's (nominal proleptic Gregorian) 2 BC,
December 31st (represented denormally) for which any time-zone data we
have is artificial and contrived. I chose Cassini's third centennary,
as it's not likely to be near any zone transitions and is within the
era of sane time-zone data.
Task-number: QTBUG-72109
Task-number: QTBUG-56787
Change-Id: I5f21ee2010070a5c1798134fdd2915a723208fd9
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 2b8b7a162be52f8cd6c2bc39f498a1ddfb59dd68)
Reviewed-by: Liang Qi <liang.qi@qt.io>
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/auto/qml/ecmascripttests/test262.py | 4 | ||||
-rw-r--r-- | tests/auto/qml/qqmllocale/tst_qqmllocale.cpp | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/tests/auto/qml/ecmascripttests/test262.py b/tests/auto/qml/ecmascripttests/test262.py index 437cd1b27d..ae4c54df9d 100755 --- a/tests/auto/qml/ecmascripttests/test262.py +++ b/tests/auto/qml/ecmascripttests/test262.py @@ -552,10 +552,10 @@ class TestSuite(object): def Main(): - # Some date tests rely on being run in pacific time. # Uncomment the next line for more logging info. #logging.basicConfig(level=logging.DEBUG) - os.environ["TZ"] = "PST8PDT" + # Some date tests rely on being run in pacific time and the USA's locale: + os.environ["TZ"] = "America/Vancouver" os.environ["LANG"] = "en_US.UTF-8" os.environ["LC_TIME"] = "en_US.UTF-8" parser = BuildOptions() diff --git a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp index d0ce83b997..4f4deaafe5 100644 --- a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp +++ b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp @@ -1268,8 +1268,8 @@ void tst_qqmllocale::timeZoneUpdated() { QByteArray original(qgetenv("TZ")); - // Set the timezone to Brisbane time - setTimeZone(QByteArray("AEST-10:00")); + // Set the timezone to Brisbane time, AEST-10:00 + setTimeZone(QByteArray("Australia/Brisbane")); DateFormatter formatter; @@ -1281,8 +1281,8 @@ void tst_qqmllocale::timeZoneUpdated() QVERIFY(obj); QVERIFY(obj->property("success").toBool()); - // Change to Indian time - setTimeZone(QByteArray("IST-05:30")); + // Change to Indian time, IST-05:30 + setTimeZone(QByteArray("Asia/Kolkata")); QMetaObject::invokeMethod(obj.data(), "check"); |