summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2019-03-21 15:07:48 +0100
committerTony Sarajärvi <tony.sarajarvi@qt.io>2019-03-22 07:32:52 +0000
commit03fadc26e7617aece89949bc7d0acf50f6f050a9 (patch)
tree2da6ae332630caa0883ca8d2dbc57495131e2460 /tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
parent1119cd4ece6555be82212b273d05d581bffb79d1 (diff)
Fix broken data for time-zones with no transitions
While an invalid time-zone shall have no transitions, so may various constant zones, like UTC. The TZ data may include only the POSIX rule for such a zone, in which case we should use it, even if there are no transitions. Broke out a piece of repeated code as a common method, in the process, since I was complicating it further. Added test for the case that revealed this; and made sure we see a warning if any of the checkOffset() tests gets skipped because its zone is unsupported. Fixes: QTBUG-74614 Change-Id: Ic8e039a2a9b3f4e0f567585682a94f4b494b558d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp')
-rw-r--r--tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
index a25fd39693..eff9835776 100644
--- a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
+++ b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
@@ -539,6 +539,8 @@ void tst_QTimeZone::checkOffset_data()
int year, month, day, hour, min, sec;
int std, dst;
} table[] = {
+ // Zone with no transitions (QTBUG-74614, when TZ backend uses minimalist data)
+ { "Etc/UTC", "epoch", 1970, 1, 1, 0, 0, 0, 0, 0 },
// Kiev: regression test for QTBUG-64122 (on MS):
{ "Europe/Kiev", "summer", 2017, 10, 27, 12, 0, 0, 2 * 3600, 3600 },
{ "Europe/Kiev", "winter", 2017, 10, 29, 12, 0, 0, 2 * 3600, 0 }
@@ -551,6 +553,8 @@ void tst_QTimeZone::checkOffset_data()
<< QDateTime(QDate(entry.year, entry.month, entry.day),
QTime(entry.hour, entry.min, entry.sec), zone)
<< entry.dst + entry.std << entry.std << entry.dst;
+ } else {
+ qWarning("Skipping %s@%s test as zone is invalid", entry.zone, entry.nick);
}
}
}