tst_QDateTime: explain one test-case more carefully

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 <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mate Barany <mate.barany@qt.io>
This commit is contained in:
Edward Welbourne 2022-12-01 19:05:37 +01:00
parent 33bb8fcae9
commit de1895f423

View File

@ -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);
}