qt5base-lts/tests/auto/corelib/tools
Chris Wilson 147aa29162 Fix sending UTC-offset QTimeZones through QDataStream
QTimeZone("UTC") should be valid, as "UTC" appears in the list of
availableTimeZoneIds(), and tst_QTimeZone::dataStreamTest() constructs
timezones like this, which are considered valid.

The internal representation of a QTimeZone("UTC") as created by
QTimeZone::QTimeZone(const QByteArray &ianaId) is a QUtcTimeZonePrivate
which isValid(), so the containing QTimeZone isValid() too.

When QTimeZone is serialized into a QDataStream, it calls
tz.d->serialize(ds) which is QUtcTimeZonePrivate::serialize. This
writes QStringLiteral("OffsetFromUtc") followed by the IANA ID and
the offset (etc.) to the datastream.

When QTimeZone is deserialized it looks for this marker string, and if
present, it passed all of the parameters to the QTimeZone constructor
(not just the name). However, that constructor does not support standard
IANA timezones (only custom ones), and when it detects that the supplied
IANA ID is actually listed in availableTimeZoneIds(), it leaves the
pointer to the QTimeZonePrivate uninitialized (NULL), which leaves
the QTimeZone invalid (isValid() returns false).

Thus, a valid timezone which was serialized and then deserialized has
become invalid. This also affects serialization of QDateTimes with
timezones.

Fixed by calling the name-only constructor first, which works (only) for
IANA standard timezones and leaves the QTimeZone invalid (isValid()
returns false) otherwise. In which case, we can call the many-argument
contructor to create a custom timezone with the same offset as the one
which was originally serialized.

[ChangeLog][QtCore][QTimeZone] Fixed sending IANA standard UTC-offset
QTimeZones through QDataStream, which previously came out invalid after
deserialization.

Task-number: QTBUG-60595
Change-Id: Id9c47e8bda701faae4d800e012afb6db545b2fe9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-06-08 08:34:31 +00:00
..
collections Fix tst_Collections for gcc/arm 2017-04-07 05:54:04 +00:00
qalgorithms Long live QTest::addRow()! 2017-01-10 07:47:26 +00:00
qarraydata tst_QArrayData: fix unused variable warning in reallocate() 2017-03-22 09:22:34 +00:00
qarraydata_strictiterators Make sure all containers compile in strict-iterator mode 2014-02-22 04:38:01 +01:00
qbitarray Updated license headers 2016-01-21 18:55:18 +00:00
qbytearray Extend qChecksum calculation 2016-12-25 08:24:18 +00:00
qbytearraylist Updated license headers 2016-01-21 18:55:18 +00:00
qbytearraymatcher Long live QStaticByteArrayMatcher! 2017-01-19 21:37:46 +00:00
qbytedatabuffer Updated license headers 2016-01-21 18:55:18 +00:00
qcache Updated license headers 2016-01-21 18:55:18 +00:00
qchar Merge remote-tracking branch 'origin/5.8' into 5.9 2017-03-21 19:07:53 +01:00
qcollator Revert "Add tests for QCollatorSortKey" 2017-02-12 08:15:48 +00:00
qcommandlineparser Properly use the "process" feature 2017-02-27 15:44:46 +00:00
qcontiguouscache Updated license headers 2016-01-21 18:55:18 +00:00
qcryptographichash QCryptographicHash: make SHA3 calculate SHA3, not Keccak 2017-03-31 07:58:35 +00:00
qdate Make sure to use C locale during time tests that assume it 2017-02-20 08:48:46 +00:00
qdatetime Merge remote-tracking branch 'origin/5.8' into 5.9 2017-03-13 15:55:44 +01:00
qeasingcurve Updated license headers 2016-01-21 18:55:18 +00:00
qexplicitlyshareddatapointer Updated license headers 2016-01-21 18:55:18 +00:00
qfreelist Use qtConfig throughout in qtbase 2016-08-19 04:28:05 +00:00
qhash QHash/QMultiHash: fix operator== 2017-05-05 12:18:25 +00:00
qhash_strictiterators Make sure all containers compile in strict-iterator mode 2014-02-22 04:38:01 +01:00
qhashfunctions tst_qhashfunctions: Test non-zero seeds too 2017-04-11 06:38:14 +00:00
qlatin1string Long live QTest::addRow()! 2017-01-10 07:47:26 +00:00
qline Add QLineF::center() returning the point in the center of the line 2016-05-27 08:49:44 +00:00
qlinkedlist Merge remote-tracking branch 'origin/5.6' into 5.7 2016-05-19 12:55:27 +02:00
qlist Merge remote-tracking branch 'origin/5.6' into 5.7 2016-05-19 12:55:27 +02:00
qlist_strictiterators Make sure all containers compile in strict-iterator mode 2014-02-22 04:38:01 +01:00
qlocale Merge remote-tracking branch 'origin/5.8' into 5.9 2017-03-13 15:55:44 +01:00
qmap QMap, QHash: make key_iterator satisfy the DefaultConstructible concept 2017-03-20 04:36:42 +00:00
qmap_strictiterators Make sure all containers compile in strict-iterator mode 2014-02-22 04:38:01 +01:00
qmargins Updated license headers 2016-01-21 18:55:18 +00:00
qmessageauthenticationcode Updated license headers 2016-01-21 18:55:18 +00:00
qpair Merge remote-tracking branch 'origin/5.6' into 5.7 2016-07-15 20:47:57 +02:00
qpoint Updated license headers 2016-01-21 18:55:18 +00:00
qpointf Updated license headers 2016-01-21 18:55:18 +00:00
qqueue Updated license headers 2016-01-21 18:55:18 +00:00
qrect Merge remote-tracking branch 'origin/5.6' into 5.7 2016-03-21 09:02:57 +01:00
qregexp QtCore: Remove Windows CE. 2016-03-30 11:22:47 +00:00
qregularexpression Merge dev into 5.8 2016-08-22 11:30:01 +02:00
qringbuffer QRingBuffer: add packet mode 2016-07-23 09:05:13 +00:00
qscopedpointer QSharedPointer/QWeakPointer/QScopedPointer: add comparison against nullptr 2016-06-08 09:09:47 +00:00
qscopedvaluerollback Updated license headers 2016-01-21 18:55:18 +00:00
qset Updated license headers 2016-01-21 18:55:18 +00:00
qsharedpointer Fix autotest not to open too many files on a Unix 2017-05-29 06:46:50 +00:00
qsize Updated license headers 2016-01-21 18:55:18 +00:00
qsizef Updated license headers 2016-01-21 18:55:18 +00:00
qstl Updated license headers 2016-01-21 18:55:18 +00:00
qstring Split Q_COMPILER_UNICODE_STRINGS: add Q_STDLIB_UNICODE_STRINGS 2017-04-20 06:50:36 +00:00
qstring_no_cast_from_bytearray Updated license headers 2016-01-21 18:55:18 +00:00
qstringapisymmetry QString(Ref): make toLatin1()/toLocal8Bit() null handling consistent 2017-02-15 20:12:36 +00:00
qstringbuilder QString: add some missing overloaded operator+ 2016-06-29 14:58:25 +00:00
qstringiterator Updated license headers 2016-01-21 18:55:18 +00:00
qstringlist Add QStringList::join(QLatin1String) overload 2016-09-18 07:28:56 +00:00
qstringmatcher QStringMatcher: fix setCaseSensitivity() on a non-QString-backed matcher 2017-02-07 16:31:00 +00:00
qstringref QStringRef: add chop() 2016-07-07 15:12:27 +00:00
qtextboundaryfinder Use QT_CONFIG(library) instead of QT_NO_LIBRARY 2017-03-06 11:27:20 +00:00
qtime Make sure to use C locale during time tests that assume it 2017-02-20 08:48:46 +00:00
qtimeline Improve QTest::qWait() precision and switch to QDeadlineTimer 2017-01-25 16:40:57 +00:00
qtimezone Fix sending UTC-offset QTimeZones through QDataStream 2017-06-08 08:34:31 +00:00
qvarlengtharray QVarLengthArray: fix appending an already-contained item 2017-02-17 07:35:31 +00:00
qvector Use qtConfig throughout in qtbase 2016-08-19 04:28:05 +00:00
qvector_strictiterators Make sure all containers compile in strict-iterator mode 2014-02-22 04:38:01 +01:00
qversionnumber tst_QVersionNumber: fix Clang warning about superfluous move 2017-03-06 11:13:17 +00:00
tools.pro Move QElapsedTimer to src/corelib/kernel 2016-07-02 07:51:45 +00:00