Check validity of startOfDay() and endOfDay() match expectation

Task-number: QTBUG-68855
Change-Id: I7fd9dac7db0f29c21e2f6e7bf284d708620508cc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Edward Welbourne 2023-04-26 12:49:28 +02:00
parent 895540b568
commit f8e1194aef

View File

@ -622,12 +622,18 @@ void tst_QDate::startOfDay_endOfDay()
QCOMPARE(date.addDays(-1).endOfDay(zone).addMSecs(1), front); QCOMPARE(date.addDays(-1).endOfDay(zone).addMSecs(1), front);
if (start.isValid()) { if (start.isValid()) {
QVERIFY(front.isValid());
QCOMPARE(front.date(), date); QCOMPARE(front.date(), date);
UNLESSKLUDGE(IgnoreStart) QCOMPARE(front.time(), start); UNLESSKLUDGE(IgnoreStart) QCOMPARE(front.time(), start);
} else UNLESSKLUDGE(IgnoreStart) {
QVERIFY(!front.isValid());
} }
if (end.isValid()) { if (end.isValid()) {
QVERIFY(back.isValid());
QCOMPARE(back.date(), date); QCOMPARE(back.date(), date);
UNLESSKLUDGE(IgnoreEnd) QCOMPARE(back.time(), end); UNLESSKLUDGE(IgnoreEnd) QCOMPARE(back.time(), end);
} else UNLESSKLUDGE(IgnoreEnd) {
QVERIFY(!back.isValid());
} }
#undef UNLESSKLUDGE #undef UNLESSKLUDGE
} }