diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2023-04-25 16:40:10 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2023-05-15 14:02:41 +0200 |
commit | 06e2719f730e4545d370f7d7dabb32a24247e6c8 (patch) | |
tree | fa2b4acd491dee75144ddf14deedd53842d81b74 | |
parent | eff0ffbd1bc32aff811bc85488ad962dfbbd7325 (diff) | |
download | qtbase-06e2719f730e4545d370f7d7dabb32a24247e6c8.tar.gz |
Add test-cases for QDate::{start,end}OfDay() at QDateTime's bounds
Task-number: QTBUG-68855
Change-Id: Ic91cb5f9947ce5ee533fc77ae24a50376e139ab3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r-- | tests/auto/corelib/time/qdate/tst_qdate.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/corelib/time/qdate/tst_qdate.cpp b/tests/auto/corelib/time/qdate/tst_qdate.cpp index 6be26bed79..ab6b8a53a9 100644 --- a/tests/auto/corelib/time/qdate/tst_qdate.cpp +++ b/tests/auto/corelib/time/qdate/tst_qdate.cpp @@ -518,9 +518,20 @@ void tst_QDate::startOfDay_endOfDay_data() constexpr MsKludges IgnoreBoth = IgnoreStart | IgnoreEnd; const QTimeZone UTC(QTimeZone::UTC); + using Bound = std::numeric_limits<qint64>; + const auto dateAtMillis = [UTC](qint64 millis) { + return QDateTime::fromMSecsSinceEpoch(millis, UTC).date(); + }; + // UTC and fixed offset are always available and predictable: QTest::newRow("epoch") << epochDate() << UTC << early << late << MsKludges{}; + // First and last days in QDateTime's supported range: + QTest::newRow("earliest") + << dateAtMillis(Bound::min()) << UTC << invalid << late << MsKludges{}; + QTest::newRow("latest") + << dateAtMillis(Bound::max()) << UTC << early << invalid << MsKludges{}; + const struct { const char *test; const char *zone; |