diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2017-11-09 18:53:51 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2017-11-30 20:19:13 +0000 |
commit | a755c2e52126bea850a04487a9a7d446b03e892a (patch) | |
tree | 63b6ad75e3eb9344909c6483a933d924d54e1e05 /tests/auto/corelib/tools/qdate | |
parent | ba19363529f4c099c6831c26d3acf98fa0c5f702 (diff) |
Raise the upper bound on years to 9999
Test-case taken from bug-report; fits in as an easy row in an existing
data-driven test. Add similar tests for date-time and time; and an
isValid test on the end of year 9999. The date-time parser was using
the end of year 7999 as maximum value for dates and date-times; extend
this to year 9999, as I can see no reason not to.
[ChangeLog][QtCore][QDateTime] Years up to 9999 can now be parsed
without error (previously 8000 and beyond were treated as invalid) in
all formats (not only in ISO format). Widgets handling dates now
support dates to 9999, likewise.
Task-number: QTBUG-64401
Change-Id: I518cfa6c2cb4ecc5a85b896dc9e56b4fdd8a8bb1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/tools/qdate')
-rw-r--r-- | tests/auto/corelib/tools/qdate/tst_qdate.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qdate/tst_qdate.cpp b/tests/auto/corelib/tools/qdate/tst_qdate.cpp index ff31f01d7c..ce1e5730dd 100644 --- a/tests/auto/corelib/tools/qdate/tst_qdate.cpp +++ b/tests/auto/corelib/tools/qdate/tst_qdate.cpp @@ -152,6 +152,9 @@ void tst_QDate::isValid_data() QTest::newRow("400-years leap 1600") << 1600 << 2 << 29 << qint64(2305507) << true; QTest::newRow("year 0") << 0 << 2 << 27 << nullJd << false; + // Test end of four-digit years: + QTest::newRow("late") << 9999 << 12 << 31 << qint64(5373484) << true; + // test the number of days in months: QTest::newRow("jan") << 2000 << 1 << 31 << qint64(2451575) << true; QTest::newRow("feb") << 2000 << 2 << 29 << qint64(2451604) << true; // same data as 400-years leap @@ -1098,6 +1101,8 @@ void tst_QDate::fromStringFormat_data() QTest::newRow("data41") << QString("21/5/06") << QString("d/M/yy") << QDate(1906,5,21); QTest::newRow("data42") << QString("20060521") << QString("yyyyMMdd") << QDate(2006,5,21); QTest::newRow("data43") << QString("060521") << QString("yyMMdd") << QDate(1906,5,21); + QTest::newRow("lateMarch") << QString("9999-03-06") << QString("yyyy-MM-dd") << QDate(9999, 3, 6); + QTest::newRow("late") << QString("9999-12-31") << QString("yyyy-MM-dd") << QDate(9999, 12, 31); } |