From de1895f423c9802de9a897d875ea978498b25b0b Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 1 Dec 2022 19:05:37 +0100 Subject: [PATCH] tst_QDateTime: explain one test-case more carefully MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the process, split some long lines. The test relies on omitting the hour (so as to get the default, 0) from both the format string and the string parsed, so as to test that the parser correctly handles the corner case where the zone skips the first hour of the day. This was not entirely obvious when reading the row data, so make it explicit in a comment. Change-Id: I919b292b78bd399a8749806a0e913d43f5b414e1 Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Thiago Macieira Reviewed-by: Mate Barany --- tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp index c61fe7e90c9..b1be194b753 100644 --- a/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp @@ -2899,8 +2899,12 @@ void tst_QDateTime::fromStringStringFormat_data() QTimeZone southBrazil("America/Sao_Paulo"); if (southBrazil.isValid()) { QTest::newRow("spring-forward-midnight") - << QString("2008-10-19 23:45.678 America/Sao_Paulo") << QString("yyyy-MM-dd mm:ss.zzz t") - // That's in the hour skipped - expect the matching time after the spring-forward, in DST: + // NB: no hour field, so hour takes its default, so that default can + // be over-ridden: + << QString("2008-10-19 23:45.678 America/Sao_Paulo") + << QString("yyyy-MM-dd mm:ss.zzz t") + // That's in the hour skipped - expect the matching time after the + // spring-forward, in DST: << QDateTime(QDate(2008, 10, 19), QTime(1, 23, 45, 678), southBrazil); }