qt5base-lts/tests/auto/widgets
Volker Hilsheimer 924b97d6ab Fix QDateTimeEdit's handling of invalid time in dst gap
During a spring forward, a time-zone omits an hour. A QDateTime with
such an hour is invalid, but QDateTimeEdit's handling of this invalid
time was not done correctly.

With this fix, up/down changes of any field that would result in an
invalid date-time corrects the time to be valid, while leaving as
much as possible of the user-entered data unchanged. To do that, we
rely on QDateTime::toMSecsSinceEpoch to return a value even for such
an invalid time, which then can be used to construct a valid
QDateTime.

Edits that would result in an invalid hour are reverted to the
previous when pressing return, if correctionMode is
CorrectToPreviousValue. This change also implements support for
CorrectToNearestValue, which uses the same mechanism as when stepping
over an invalid time.

Include a test that verifies that the various interactions result
in a reasonable value. Since QDateTimeEdit does not respect the
timezone or timespec of the QDateTime it is initialized with, we
have to find the first hour of daylight saving time for a year
that we know works for most time zones. Failing that, we have to
skip the tests. Verified in a wide range of time zones.

Change-Id: I05b906ae3b5f6681891d23704f00f9c10cd479ae
Fixes: QTBUG-79803
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-02-27 19:35:28 +01:00
..
dialogs QWizard: deprecate visitedPages and add visitedIds instead 2020-02-27 19:35:19 +01:00
effects tst_qgraphicseffect: Wait for exposed instead of active 2019-10-15 20:39:32 +02:00
graphicsview Merge remote-tracking branch 'origin/5.14' into 5.15 2020-02-04 10:44:00 +01:00
itemviews Merge remote-tracking branch 'origin/5.14' into 5.15 2020-02-24 08:40:45 +01:00
kernel Merge remote-tracking branch 'origin/5.14' into 5.15 2020-02-26 01:00:08 +01:00
styles Merge remote-tracking branch 'origin/5.14' into 5.15 2020-01-15 01:00:39 +01:00
util Merge remote-tracking branch 'origin/5.14' into 5.15 2020-01-28 08:09:51 +01:00
widgets Fix QDateTimeEdit's handling of invalid time in dst gap 2020-02-27 19:35:28 +01:00
widgets.pro Move QGestureRecognizer test to widgets/kernel 2017-06-02 18:36:11 +00:00