qt5base-lts/tests/auto/corelib/time
Edward Welbourne 60deb69034 Distinguish invalid datetimes from others
A default-constructed QDateTime is invalid, but compared equal to a
valid one referencing the start of 1970.  This lead to date properties
in QML being initialized invalid but not getting an onChange if the
first value they're set to is the start of 1970.

Fixing that then lead to some tests failing. Indeed, the original
equality check involved using toMSecsSinceEpoch(), whose value is
undefined unless the datetime is valid, without a prior check on its
validity: so ensure all uses of toMSecsSinceEpoch() are guarded with
isValid() checks.

Reworked tst_QDateTime::toSecsSinceEpoch() to use its bool column
(previously unused, after separating from toTime_t(), which uses this
column for "out of time_t's range") for validity of the datetime.

[ChangeLog][QtCore][QDateTime] Invalid datetimes are now treated as
equal and less than all valid ones. They could previously be found
equal to valid datetimes.

Fixes: QTBUG-79006
Change-Id: Ie72deb8af4350a5e808144d0f6e42dc8eb3ff5ef
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-10-11 11:59:41 +02:00
..
qcalendar Rename calendar methods from m{in,ax} to m{in,ax}imum 2019-09-04 18:43:35 +02:00
qdate Remove usages of deprecated APIs from QDateTime 2019-07-02 09:49:36 +02:00
qdatetime Distinguish invalid datetimes from others 2019-10-11 11:59:41 +02:00
qtime Separate out the time, zone, date code from corelib/tools/ 2019-06-06 15:54:32 +02:00
qtimezone Separate out the time, zone, date code from corelib/tools/ 2019-06-06 15:54:32 +02:00
time.pro Add support for calendars beside Gregorian 2019-08-20 13:41:21 +02:00