From a4f5f25eb05f49474eaef665abdbcaad9203ba48 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 5 Jun 2019 10:50:28 +0200 Subject: Move YearRange to QDateTime from its Private As planned when adding YearRange: now that it's merged up to dev, move it to QDateTime, since we can add to the API at 5.14.0. This follows up on commit 82ad4be4a2e0c2bccb6cd8ea2440aefee4ec48ec. Change-Id: I81b6c2331121a71e2592514781c02c5756e70c52 Reviewed-by: Thiago Macieira --- tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') diff --git a/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp index c5377379ea..609b58cf85 100644 --- a/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp @@ -147,6 +147,7 @@ private slots: void systemTimeZoneChange() const; void invalid() const; + void range() const; void macTypes(); @@ -3475,6 +3476,15 @@ void tst_QDateTime::invalid() const QCOMPARE(tzDate.timeSpec(), Qt::TimeZone); } +void tst_QDateTime::range() const +{ + using Bounds = std::numeric_limits; + QCOMPARE(QDateTime::fromMSecsSinceEpoch(Bounds::min() + 1, Qt::UTC).date().year(), + int(QDateTime::YearRange::First)); + QCOMPARE(QDateTime::fromMSecsSinceEpoch(Bounds::max() - 1, Qt::UTC).date().year(), + int(QDateTime::YearRange::Last)); +} + void tst_QDateTime::macTypes() { #ifndef Q_OS_MAC -- cgit v1.2.3