summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-06-26 03:08:33 -1000
committerTony Sarajärvi <tony.sarajarvi@qt.io>2017-08-24 10:17:55 +0000
commit0593bd577168cdf8b4318d4e46ea463f433f8bb2 (patch)
treec6fc96942de1b47b4ce792756d7ad2e7c961714a
parentbe77d8798a1df1cb928b944c145db3fa9aeb9777 (diff)
Fix tst_calendar::MonthGrid::test_locale()v5.6.3
When the JS Date constructor is passed a string in the ISO 8601 format (e.g. "1970-01-01"), it is treatead as UTC, not local. Therefore, while comparing the expected dates from the model, we must base the comparison on UTC as well. Otherwise, the actual and expected dates may differ due to the timezone difference. This issue was detected thanks to a new CI setup that had accidentally UTC+8 timezone set. Task-number: QTBUG-61535 Change-Id: I93cfce5a81d48dc859f002dcd6b59ddb0701911c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit eea527e1d4f8182d13a5fc5597370ac50cdaa5fe) Reviewed-by: Joni Jäntti <joni.jantti@qt.io>
-rw-r--r--tests/auto/calendar/data/tst_monthgrid.qml24
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/auto/calendar/data/tst_monthgrid.qml b/tests/auto/calendar/data/tst_monthgrid.qml
index 6c60f92f..43a0bad1 100644
--- a/tests/auto/calendar/data/tst_monthgrid.qml
+++ b/tests/auto/calendar/data/tst_monthgrid.qml
@@ -92,13 +92,13 @@ TestCase {
for (var i = 0; i < 42; ++i) {
var cellDate = new Date(en_GB[i])
- compare(control.contentItem.children[i].date.getFullYear(), cellDate.getFullYear())
- compare(control.contentItem.children[i].date.getMonth(), cellDate.getMonth())
- compare(control.contentItem.children[i].date.getDate(), cellDate.getDate())
- compare(control.contentItem.children[i].day, cellDate.getDate())
+ compare(control.contentItem.children[i].date.getFullYear(), cellDate.getUTCFullYear())
+ compare(control.contentItem.children[i].date.getMonth(), cellDate.getUTCMonth())
+ compare(control.contentItem.children[i].date.getDate(), cellDate.getUTCDate())
+ compare(control.contentItem.children[i].day, cellDate.getUTCDate())
compare(control.contentItem.children[i].today, cellDate === new Date())
- compare(control.contentItem.children[i].month, cellDate.getMonth())
- compare(control.contentItem.children[i].year, cellDate.getFullYear())
+ compare(control.contentItem.children[i].month, cellDate.getUTCMonth())
+ compare(control.contentItem.children[i].year, cellDate.getUTCFullYear())
}
// en_US
@@ -115,13 +115,13 @@ TestCase {
for (var j = 0; j < 42; ++j) {
cellDate = new Date(en_US[j])
- compare(control.contentItem.children[j].date.getFullYear(), cellDate.getFullYear())
- compare(control.contentItem.children[j].date.getMonth(), cellDate.getMonth())
- compare(control.contentItem.children[j].date.getDate(), cellDate.getDate())
- compare(control.contentItem.children[j].day, cellDate.getDate())
+ compare(control.contentItem.children[j].date.getFullYear(), cellDate.getUTCFullYear())
+ compare(control.contentItem.children[j].date.getMonth(), cellDate.getUTCMonth())
+ compare(control.contentItem.children[j].date.getDate(), cellDate.getUTCDate())
+ compare(control.contentItem.children[j].day, cellDate.getUTCDate())
compare(control.contentItem.children[j].today, cellDate === new Date())
- compare(control.contentItem.children[j].month, cellDate.getMonth())
- compare(control.contentItem.children[j].year, cellDate.getFullYear())
+ compare(control.contentItem.children[j].month, cellDate.getUTCMonth())
+ compare(control.contentItem.children[j].year, cellDate.getUTCFullYear())
}
control.destroy()