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>
This commit is contained in:
parent
eff0ffbd1b
commit
06e2719f73
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user