From e1323ec25afa055d9e4a19fcdef81e6c849755e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Arve=20S=C3=A6ther?= Date: Tue, 16 Jul 2019 13:49:48 +0200 Subject: [PATCH] Improve diagnostics of timeZoneUpdated test Change-Id: I5f6eef1710704cf463df4c6843e3c24e23cf0aa6 --- tests/auto/qml/qqmllocale/data/timeZoneUpdated.qml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/auto/qml/qqmllocale/data/timeZoneUpdated.qml b/tests/auto/qml/qqmllocale/data/timeZoneUpdated.qml index ba34e00..fd32403 100644 --- a/tests/auto/qml/qqmllocale/data/timeZoneUpdated.qml +++ b/tests/auto/qml/qqmllocale/data/timeZoneUpdated.qml @@ -6,12 +6,21 @@ Item { property date localDate property date utcDate + function compareEval(actualStrExpr, expectedStrExpr) { + var act = eval(actualStrExpr) + var exp = eval(expectedStrExpr) + if (act != exp) { + console.warn('compareEval(' + actualStrExpr + ', ' + expectedStrExpr + '): ' + act + ' != ' + exp) + } + return (act == exp) + } + Component.onCompleted: { // Test date: 2012-06-01T02:15:30+10:00 (AEST timezone) localDate = new Date(2012, 6-1, 1, 2, 15, 30) utcDate = new Date(Date.UTC(2012, 6-1, 1, 2, 15, 30)) - if (localDate.getTimezoneOffset() != -600) return + compareEval('localDate.getTimezoneOffset()', '-600') if (localDate.toLocaleString() != getLocalizedForm('2012-06-01T02:15:30')) return if (localDate.toISOString() != "2012-05-31T16:15:30.000Z") return -- 2.10.1.windows.1