Commit Graph

15 Commits

Author SHA1 Message Date
Edward Welbourne
0ad4f86729 Purge QRegExp use in QDateTime's rfcDateImpl()
Replace with a parser which actually does the job right, fixing
various infelicities in the parsing in the process.
Make the parser strict about formatting.

Adjusted tests to match. Fixed some QTime invalidity tests to each
test only one invalidity at a time (the invalid year and day tests
also used an invalid month).

[ChangeLog][QtCore][QDateTime] The parser for the Qt::RFC2822Date
format is now stricter, requiring the text to exactly match the form
of one of the relevant formats. A valid date or time will still be
parsed, even if the other part of the content is invalid, as long as
it (and any offset, if present) has the right form. In particular, the
parser now rejects texts with trailing cruft (other than space).

Fixes: QTBUG-80038
Change-Id: Id25675afd75f82f6351f20e79f0154f3ceda35ac
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-02-27 10:48:25 +01:00
Alexandru Croitor
c53ee1f054 Merge remote-tracking branch 'origin/wip/cmake' into dev
Conflicts:
	tests/manual/rhi/hellominimalcrossgfxtriangle/CMakeLists.txt

Hopefully final merge from wip/cmake, and then all cmake changes
should target dev directly.

Change-Id: I29b04c9b0284e97334877c77a32ffdf887dbf95b
2020-02-13 23:29:51 +01:00
Liang Qi
6b2535ea15 Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
	examples/widgets/graphicsview/boxes/scene.h
	src/corelib/Qt5CoreMacros.cmake
	src/corelib/Qt6CoreMacros.cmake
	src/network/ssl/qsslsocket.cpp
	src/network/ssl/qsslsocket.h
	src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp
	src/testlib/CMakeLists.txt
	src/testlib/.prev_CMakeLists.txt
	tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp

Disabled building manual tests with CMake for now, because qmake
doesn't do it, and it confuses people.

Done-With: Alexandru Croitor <alexandru.croitor@qt.io>
Done-With: Volker Hilsheimer <volker.hilsheimer@qt.io>
Change-Id: I865ae347bd01f4e59f16d007b66d175a52f1f152
2020-02-13 18:31:40 +01:00
Alexandru Croitor
0d177053b9 Regenerate projects one last time before merge
Change-Id: Ia24cf56b79ca6dacd370a7e397024e9b663e0167
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-02-12 17:30:49 +00:00
Edward Welbourne
d6d98f782a Deprecate locale-related DateFormat enum members
Qt 6 shall remove all locale-dependence from Q(Date|Time)+.

Task-number: QTBUG-80441
Change-Id: Iebaaa2bd776bccfe0d73c15f36cbdd456b71ca59
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-01-31 19:20:43 +01:00
Leander Beernaert
502d3d6744 Merge remote-tracking branch 'origin/dev' into merge-dev
Change-Id: I31b761cfd5ea01373c60d02a5da8c33398d34739
2020-01-24 13:17:33 +01:00
Edward Welbourne
e0be3ab28e Combine negativeYear() and printNegativeYear()
They overlapped and the latter had duplicated code, so make them into
a single data-driven test. At the same time, replace the '-' at the
start of the expected string with QLocale::negativeSign(), since the
test fails otherwise when LC_NUMERIC=nb_NO on Linux (Debian/testing).

Change-Id: I051c75abff16b2e6f8278fcb152b6bde14c71f9a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-01-14 10:47:19 +01:00
Edward Welbourne
52affd322c Be consistent in the RFC2822Date invalid character tests
The ones we reject used a zero offset while the one that does parse
(though it shouldn't - revised comment) has a one hour offset. Made
them all use that offset and added a partner test that has no invalid
characters, so ensure the success of the invalid character tests isn't
due to falsely rejecting the valid date/time text to which the invalid
characters are added.

Task-number: QTBUG-80038
Change-Id: I6e3dd79b981af6803e60877229c56599cfd719cb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-11-27 18:27:43 +01:00
Edward Welbourne
0debb205b2 Permit leading space at start of RFC 2822 Date format
Relevant RFCs explicitly permit such space.

Change-Id: I8eb444e96287368cbbf973c77513b43d1d36f972
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-11-27 18:27:43 +01:00
Edward Welbourne
6566157df3 Make Qt::RFC2822Date's doc match up with its implementation
The qdatetime implementation's rfcDateImpl() uses regexes which did
not match its comments; nor did either the regexes or the comments
match what was documented. A review of relevant RFCs suggests we
should revise this in future, probably at Qt 6.

The documentation also only addressed the formats recognized when
parsing a date-time, without indicating how they are serialised or how
dates and times are handled separately.

Added a note to the tests for the read-only formats, to remind the
reader that the RFCs merely recommend recognising these - be
permissive in what you expect and strict in what you deliver.

Change-Id: I0f0bec752e7a50bde98cceceb7e0d11be15c6a6f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-11-27 18:27:43 +01:00
Frederik Gladhorn
b3b2c799f8 cmake: add tests in corelib/time
Change-Id: Idcd5d1be7503b50a43954c1b209e48a32cc8eaa9
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-04 06:30:36 +00:00
Alexandru Croitor
4dac45c9ee Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
Change-Id: I715b1d743d5f11560e7b3fbeb8fd64a5e5ddb277
2019-07-11 17:17:51 +02:00
Sona Kurazyan
8c8eae279d Remove usages of deprecated APIs from QDateTime
- Replaced the usages of:
  * QDateTime::toTime_t() -> QDateTime::toSecsSinceEpoch().
  * QDateTime::fromTime_t() -> QDateTime::fromSecsSinceEpoch().
  * QDate::shortDayName() -> QLocale::system().dayName().
  * QTime by QElapsedTimer, where the deprecated methods of QTime
    were used.

- Modified the tests for the deprecated methods to be enabled only
  when the corresponding methods are enabled: when the deprecated
  APIs are disabled, the tests will be also disabled, and the
  compilation won't be broken.

Task-number: QTBUG-76491
Change-Id: I4d565db2329e580c567aae511696eb1efe120843
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-07-02 09:49:36 +02:00
Alexandru Croitor
fe3bd212fc Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
This changes many different CMake places to mention Qt6 instead of
Qt5.

Note that some old qt5 cmake config files in corelib are probably not
needed anymore, but I still renamed and kept them for now.

Change-Id: Ie69e81540386a5af153f76c0242e18d48211bec4
2019-06-14 16:31:09 +02:00
Edward Welbourne
548513a4bd Separate out the time, zone, date code from corelib/tools/
We'll be adding calendar code here as well, and tools/ was getting
rather crowded, so it looks like time to move out a reasonably
coherent sub-bundle of it all.

Change-Id: I7e8030f38c31aa307f519dd918a43fc44baa6aa1
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-06-06 15:54:32 +02:00