summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/serialization
Commit message (Collapse)AuthorAgeFilesLines
* Add license headers to cmake filesLucie Gérard2022-08-0314-0/+42
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Don't use PUBLIC_LIBRARIES for tests and test helpersAlexandru Croitor2022-07-286-6/+6
| | | | | Change-Id: I9b7404e1d3a78fe0726ec0f5ce1461f6c209e90d Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* QCursor: add missing QT_DEPRECATED_VERSION_X_6_0 for deprecated methodsIvan Solovev2022-07-211-6/+6
| | | | | | | | | | | | | | | | | When the method is wrapped into if QT_DEPRECATED_SINCE(MAJ, MIN) we also need to add QT_DEPRECATED_VERSION_[X_]_MAJ_MIN macro right in front of the method declaraion, to actually trigger a deprecation warning. This patch does that for QCursor's deprecated methods, and fixes all related compilation warnings in QtBase. Task-number: QTBUG-104857 Pick-to: 6.4 6.3 6.2 Change-Id: Ic8d059e8c852d4b2dee55e7ea94f4fc7a402cdf4 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Port QXmlStremReader to QAnyStringViewSona Kurazyan2022-07-121-0/+22
| | | | | | | | | | | | | | | | Port the constructor and addData() method to QAnyStringView, but keep the overloads taking a QByteArray to avoid extra copies when actual QByteArray is passed. These overlaods need to be Q_WEAK_OVERLOADs, to avoid ambiguities (e.g. for const char * arguments). Additionally, add a test to make sure the patch doesn't break parsing from a QLatin1StringView input. [ChangeLog][QtCore][QXmlStremReader] Added constructor and addData() overloads taking QAnyStringView. Change-Id: I0efaab82a2123271c88407e380f3c67d1099a4a6 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QJsonValue: fix incorrect to{Array,Object} when the value is emptyThiago Macieira2022-06-211-2/+16
| | | | | | | | | | | | This is a repeat of commit de6ced66920600e659dbaa2509526a3bcb0b3360 "QCborValue: fix incorrect to{Array,Map} when the value is empty" (6.4), which fixed the same thing for QCborValue. I've just copied the exact same implementation onto the QJsonValue functions. Pick-to: 6.2 6.3 6.4 5.15 Fixes: QTBUG-104085 Change-Id: I175efddd75f24ae59057fffd16f6b257bf7ed36d Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Increase timeout of slow test for ASAN-enabled buildDimitrios Apostolou2022-06-151-0/+4
| | | | | Change-Id: Iea0802220701501f18822a5eb1f1b0c22f62e705 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-1616-488/+33
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QTextStream: complete char16_t supportMarc Mutz2022-05-041-0/+9
| | | | | | | | | | ... by providing also op>> for char16_t. [ChangeLog][QtCore][QTextStream] Added op>>(char16_t&). Change-Id: I2f6cc2b2cdacd5190d364f94c1830f6de62d3b7e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QTextStream: fix streaming of char16_t'sMarc Mutz2022-05-031-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | Clazy complains about all uses of QLatin1Char these days, but if one actually applies the fixit to turn out << QLatin1Char(' '); into out << u' '; the space is now streamed as an int (20), not as a space. Fix by providing an explicit char16_t overload. [ChangeLog][QtCore][QTextStream] Added op<<(char16_t). [ChangeLog][Important Behavior Changes] QTextStream streams char16_t's as QChars now instead of outputting the numeric value. If you want to preserve the old behavior, cast the char16_t to a numeric type, such as ushort or int, and stream that. This is backwards-compatible. Pick-to: 6.3 Change-Id: I42d422cdebb27d38ac1714b22ef186642ec407e7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Skip test that fails with Address Sanitizer enabledDimitrios Apostolou2022-04-121-0/+7
| | | | | | | | | | | | | | These particular testcases request huge buffers from malloc() .This is intentional and the test expects malloc() to return NULL. Address sanitizer catches this and considers it a problem. Could also be skipped in runtime by setting the environment variable: ASAN_OPTIONS=allocator_may_return_null=1 Task-number: QTBUG-89400 Change-Id: Id3a9b586be9c0bad4a007e1731f2bc1a879cc76e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Don't use QSKIP() when merely eliding part of a testEdward Welbourne2022-04-071-25/+23
| | | | | | | | | | | | | | | | | Use of QSKIP() means the whole test is skipped; when all applicable parts of a test have passed and some part of the test is inapplicable, merely report that it is skipped, rather than discarding the PASS for all the parts that do work. In the process, eliminate a spurious layer of indentation; the earlier test only needed a scope to contain its declaration, a goal adequately achieved by the scope of the if constexpr block. Task-number: QTBUG-99123 Pick-to: 6.2 6.3 Change-Id: Ie4790a24ebf49a7f3035ffad42d78450e1560832 Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Replace uses of _qs with _s in testsSona Kurazyan2022-04-071-1/+3
| | | | | | Task-number: QTBUG-101408 Change-Id: If092a68828a1e8056259cf90d035d9a87989244b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Disable test tst_qxmlstream for QNXPasi Petäjäjärvi2022-03-251-1/+1
| | | | | | | | | Copying lot of testdata over NFS to qemu image start failing with errors of "No space left on device" even there is enough space left. Pick-to: 6.2 6.3 Change-Id: I2a417ed5b8c131e0a1f68c37b1fc2446ea013304 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* CI: Add docker support for tst_qtextstream testPasi Petäjäjärvi2022-03-242-1/+7
| | | | | | | | | | | Currently test relies solely for external test server. This makes it not possible to run test successfully with environment where docker is used. Pick-to: 6.2 6.3 Change-Id: If716921ce6ceea1ced2d0d7025c6e9768b4ed7a7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Tests: Do not depend on transitive includesFabian Kosmale2022-03-172-0/+5
| | | | | Change-Id: Ibc6a948480a904913a5427e6408d4d296784fb4f Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Revert "Blacklist: test cases blacklisted in tst_QXmlStream:"Heikki Halmet2022-03-151-4/+0
| | | | | | | | | | This reverts commit d3a297c0ab96baf831ce43f0271515989a980b5f. Reason for revert: Unnecessary blacklisting Task-number: QTBUG-101332 Change-Id: I1e2c94585e719199724695347b243dffcde49259 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* Activate tst_qxmlstream for AndroidAndreas Buhr2022-03-023-11/+42
| | | | | | | | | | | | | | | | | tst_qxmlstream was disabled because it crashed. It does not any more. But it extracted an input zip archive in-place, which is not possible on Android. To resolve this, input files are copied to a temporary directory first. Also, input directories were given to rcc. rcc has a problem with recursive directories. To circumvent this, the file list is created in CMake and then given to rcc. Task-number: QTBUG-87671 Pick-to: 6.2 6.3 Change-Id: I88bb823b9e5c085404e263d4a648d65c9cd6024c Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Blacklist: test cases blacklisted in tst_QXmlStream:CI Insignificant Platforms Monitor Bot2022-02-281-0/+4
| | | | | | | | | | - initTestCase on qnx Pick-to: 6.2 Pick-to: 6.3 Task-number: QTBUG-101332 Change-Id: Ie7c561f4c92ec08c1562becefc928c34bc0eed67 Reviewed-by: CI Insignificant Platforms Monitor Bot <ci_insignificant_platforms_monitor_bot@qt.io>
* QJsonObject::removeAt: stop dividing and multiplying by 2Thiago Macieira2022-02-151-2/+3
| | | | | Change-Id: I89446ea06b5742efb194fffd16bb7d17182c6a2a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QJsonValueConcreteRef: optimize concrete()Thiago Macieira2022-02-151-4/+2
| | | | | | | | | | | | Inline the content to avoid a round-trip through qjsonarray.cpp and qjsonobject.cpp. This change revealed an inadviseable unit test check that dereferences the end() iterator to get its type. I haven't changed it, but have marked with ###. I also fixed a likely copy&paste mistake in that test. Change-Id: I89446ea06b5742efb194fffd16bb774f3bfbe5f5 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QJsonObject::erase: erase unnecessary and wrong codeThiago Macieira2022-02-151-9/+62
| | | | | | | | | | | | | | | | | | | | Commit 35adb74ddd915831789f0175423660f8e898942e ("Reimplement JSON support on top of Cbor") accidentally forgot to multiply by 2 the index stored in the QJsonObject::iterator. The same mistake was propagated when QJsonObject::iterator was converted to QJsonValueRef. This had no ill effects because the o->elements container would always contain more elements, but it meant the check was ineffective and meant nothing. So instead of doing nothing when the iterator does not point to this container, simply assume it does. Bad things will happen if you try to erase an iterator that points to another container, but that's true for almost all container/iterator mechanisms. Drive-by modernization of some of the surrounding lines. Change-Id: I89446ea06b5742efb194fffd16bb7c322c2fc4f2 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QCborArray: allow large but in-range keysThiago Macieira2022-02-151-0/+25
| | | | | | | | The 0x10000 limit should not apply if the key is a valid index in the array. Change-Id: I5e52dc5b093c43a3b678fffd16b6a2a5a69acd61 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Introduce Q{Json,Cbor}ValueConstRefThiago Macieira2022-02-151-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I screwed up when I wrote QCborValueRef by not having the ConstRef type. The code worked, but it wasn't const-correct, allowing you to write: const QCborArray &arr = something(); *arr.begin() = QCborArray(); This mistake was brought over to QJsonValue in Qt 6.0, so it has to be fixed for QJsonValue too. The actual fixes are in the next couple of commits. This change is believed to be binary-compatible: the Q{Json,Cbor}ValueRef classes continue to have the exact same size, except that they're now empty and have a new base class. They weren't trivial before this commit doesn't change that. [ChangeLog][Potentially Source-Incompatible Changes] The iterator classes for Qt's JSON and CBOR containers (array and map/object) had a const correctness issue which allowed a const_iterator to mutate the container being iterated on, even if that container was itself const. Qt 6.4 has a fix for this, but will cause compilation issues where QCborValueRef and QJsonValueRef were used where the correctness could be violated. To keep code compiling with both 6.3 and 6.4, either change to non-const iteration or replace the QxxxValueRef with a const QxxxValue reference. This change is binary-compatible. Change-Id: I5e52dc5b093c43a3b678fffd16b6063333765ae0 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* QCborValueRef: fix using operator[] to convert an empty array to mapThiago Macieira2022-02-151-8/+207
| | | | | | | | | | | The flag IsContainer was not set, causing the QCborContainerPrivate to become confused. This commit also expands and subsumes the existing test for QCborValue (non-Ref). Change-Id: I5e52dc5b093c43a3b678fffd16b6a17c6f4a0676 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QCborValueRef: add a test to confirm that its methods reflect QCborValueThiago Macieira2022-02-151-1/+163
| | | | | | | | | | | This has found several missing const qualifications, a missing QCborMap::Iterator method, and a missing one in QCborValue too. The methods "### TEMPORARY" in this commit are actually removed in two commits. Change-Id: I5e52dc5b093c43a3b678fffd16b6939f62954dc4 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Exclude denormal test cases if system doesn't support itTatiana Borisova2022-02-151-21/+75
| | | | | | | | | | | | - current INTEGRITY development pack don't support denormals for float and double. All values are rounded to 0. Task-number: QTBUG-99123 Pick-to: 6.2 6.3 Change-Id: Iaaacdc4210c7ac2ec3ec337c61164a1ade0efb01 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Cleanup tests that add test data to resources explicitlyAlexey Edelev2022-02-113-67/+12
| | | | | | | | | | | | Remove Integrity and Android specific code that explicitly adds test data to the resource files. qt_internal_add_test functions implicitly adds test data to resources for Android and Integrity platforms by default. Change-Id: Ia1d58755b47442e1953462e38606f70fec262368 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* qtextstream.h: streamline includesFabian Kosmale2022-02-101-0/+1
| | | | | | | | | | | [ChangeLog][Potentially Source-Incompatible Changes] The qtextstream header no longer includes <QString>, <QStringEncoder> and <QStringDecoder>. Code which relied on the implicit inclusion of those classes might now need to include the headers explicitly. Task-number: QTBUG-97601 Change-Id: Ifb8c8452026195a772c0588dbbbc53fb51cac548 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix C++20 ambiguous relational operators between QJsonValue{,Ref}Marc Mutz2022-02-091-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In C++20, any given relational operator is also considered in its reversed form, so e.g. given op==(X, Y) and X x, Y y, then y == x will compile, by using the reversed op(X, Y) This, unfortunately, makes some existing asymmetric operator overload sets ambiguous, and instead of applying tie-breaker rules, at least Clang is warning about these. For us, this means we need to make our overload set non-ambiguous. The QJsonValue{,Ref} classes failed this, because they only provide the following member-operators: - QJsonValue::op==(const QJsonValue&) const - QJsonValueRef::op==(const QJsonValue &) const For member functions, there are no implicit conversions on the LHS. So in C++17, we have a nice dichotomous overload set: - LHS is QJsonValue -> use QJsonValue::op==(QJsonValue) - LHS is QJsonValueRef -> use QJsonValueRef::op==(QJsonValue) In both of these, it the RHS is a QJsonValueRef, it's implicitly converted to QJsonValue for the call. Enter C++20, and the reversed signatures are suddenly available, too, which is a problem for QJsonValueRef <> QJsonValueRef, which could be resolved, as in C++17, using lhs.QJVR::op==(QJV(rhs)) or it could now be rhs.QJVR::op==(QJV(lhs)); // reversed Says Clang 10: tst_qtjson.cpp:990:5: warning: ISO C++20 considers use of overloaded operator '==' (with operand types 'QJsonValueRef' and 'QJsonValueRef') to be ambiguous despite there being a unique best viable function [-Wambiguous-reversed-operator] CHECK(r0, a0, r1); ^ ~~ ~~ qjsonvalue.h:189:17: note: ambiguity is between a regular call to this operator and a call with the argument order reversed inline bool operator==(const QJsonValue &other) const { return toValue() == other; } ^ A similar argument makes op!= ambiguous. Says Clang 10: tst_qtjson.cpp:988:5: error: use of overloaded operator '!=' is ambiguous (with operand types 'QJsonValueRef' and 'QJsonValueRef') CHECK(r0, r0, r1); ^ ~~ ~~ qjsonvalue.h:190:17: note: candidate function inline bool operator!=(const QJsonValue &other) const { return toValue() != other; } ^ qjsonvalue.h:189:17: note: candidate function inline bool operator==(const QJsonValue &other) const { return toValue() == other; } ^ qjsonvalue.h:189:17: note: candidate function (with reversed parameter order) To fix, provide the missing operators as free inline functions (so Qt 6.2 and 5.15 don't get new symbols added) so there's always exactly one best match. This is a fix for 6.2 and 5.15. At the time of writing, 6.3 isn't released, yet, so there, we could QT_REMOVED_SINCE the pre-existing member operators in favor of hidden friends (as per QTBUG-87973). Use C++17'isms to prevent an automatic merge to 5.15, which requires contains(QT_CONFIG,c++2a):CONFIG += c++2a added to tst_qtjson.pro. [ChangeLog][QtCore][QJsonValue] Fixed relational operators to not cause warnings/ambiguities when compiling in C++20. Pick-to: 6.3 6.2 5.15 Change-Id: Ic70f3cad9987c87f7346d426c29cc2079d85ad13 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QCborValue: fix incorrect to{Array,Map} when the value is emptyThiago Macieira2022-02-031-0/+87
| | | | | | | | | | When QCborValue referred to an empty array or map, toArray() and toMap() would respectively return the default value instead of the empty object, as expected. Pick-to: 6.2 6.3 Change-Id: I5e52dc5b093c43a3b678fffd16b60456d0037ad7 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* JSON: Further improve the duplicate handling in the parserUlf Hermann2022-01-215-10/+123
| | | | | | | | Avoid some unnecessary comparisons and add more tests. Task-number: QTBUG-99799 Change-Id: I3aee9f0b62461d38dadbe8e969444e1cd1f94e68 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* tst_QtJson: fix test for numbers above the limit of qint64Thiago Macieira2022-01-191-10/+7
| | | | | | | | | | | | | Commit 289f909621a8d83320d33e3ff7d651c164034098 ("Test conversion of ulonglong variant to JSON") was trying to ensure the result becomes a double. So there's no reason to make a test in the _data() function. Drive-by fix the UB condition on Windows (ulong is 32-bit, so 1ul << 63 is UB). Change-Id: I0e5f6bec596a4a78bd3bfffd16ca4f8f5219f785 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* JSON: When clearing duplicate object entries, also clear containersUlf Hermann2022-01-181-0/+19
| | | | | | | | | | | | | | | | | Previously, if you had multiple entries with the same name in an object, and some of them were again objects or arrays, parsing the JSON document would leak memory. Also, we use std::stable_sort instead of std::sort now, so that we don't accidentally randomize the order of elements with equal keys. [ChangeLog][QtCore][JSON] A memory leak in the JSON parser when reading objects with duplicate keys was fixed. Pick-to: 5.15 6.2 6.3 Fixes: QTBUG-99799 Change-Id: Ic2065f2e490c2d3506a356745542148ad9c24262 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove unused .qrc filesJoerg Bornemann2022-01-172-13/+0
| | | | | | | | Task-number: QTBUG-94446 Change-Id: I136d8b4ab070a832866aa50b5701fc6bd863df8a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove execute permission from XML filesEdward Welbourne2022-01-174-0/+0
| | | | | | | | | | | Files that are not meant to be executed should not have the execute permission bit set. Task-number: QTBUG-81503 Pick-to: 6.3 6.2 5.15 Change-Id: I10666bd958adfc5c425216bcff7456facd1fe5f3 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
* Exclude tst_qxmlstream test for INTEGRITYTatiana Borisova2021-12-281-1/+1
| | | | | | | | | | - There is no possibility to unpack *.zip archive anywhere on test device or save any file. Currently we don't have mounted file system. Task-number: QTBUG-99123 Pick-to: 6.2 6.3 Change-Id: I8c8d272a92b4475a7548bd10d32fc4203672926b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix tst_qtextstream / tst_json run time failures on INTEGRITY deviceTatiana Borisova2021-12-283-2/+24
| | | | | | | | | - add test resources to binaries Task-number: QTBUG-99123 Pick-to: 6.2 6.3 Change-Id: Ibeed93af43b4f951ca55f044fbfab00d4ab30468 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QXmlStreamReader: update test distributionIvan Solovev2021-12-19653-3918/+27
| | | | | | | | | | | | | | | | | | | | | | | | As mentioned in the linked bugreport, we are not allowed to distribute the uncompressed files from one of the XML test datasets that we use in our tests. This patch removes the uncompressed version, and replaces it by the xmltest.zip archive taken from [0]. Once the test is started, QZipReader is used to uncompress the archive, and once the test is done, the uncompressed data is removed. However the test data from [0] is very old, so it is slightly different from what we had previously (the previous data was taken from w3c). As a result, 4 test cases are failing with this data. To fix it, we store the updated versions of 4 xml files separately, and replace them after uncompressing the archive. [0]: http://www.jclark.com/xml/ Fixes: QTBUG-81503 Pick-to: 6.3 6.2 5.15 Change-Id: Ied5233970a529deebca56b1eab07fe1c328a2ee0 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QVariant: use a typedef name when saving user types to QDataStreamThiago Macieira2021-12-174-0/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to the way Qt 5 and 6 registered type names, they end up producing different type names for the same content for a typedef. For example, because Q_DECLARE_METATYPE can't manage a comma (it's a macro), users are forced to write something like: using MyTypeMap = QMap<QString, MyType> Q_DECLARE_METATYPE(MyTypeMap) Qt 5's Q_DECLARE_METATYPE's argument "MyTypeMap" was the only name we knew about the type, so that's what got saved in the stream. However, Qt 6 QtPrivate::typenameHelper is much more clever and obtains the name from the compiler itself, so it "sees through" the typedef and registers "QMap<QString,MyType>" as the official type name. If another library/plugin has a different typedef name for the same type (e.g., StringTypeMap), it's indeterminate which type gets saved and will even change from run to run (depends on the QHash order). [ChangeLog][QtCore][QDataStream] If QDataStream is used with a QDataStream::Version < Qt_6_0 to serialize a user type that was registered via a typedef with the metatype system, the typedef's name is used in the stream instead of the non-typedef name. This restores compatibility with Qt 5, allowing existing content to read the same QDataStreams; reading from older Qt 6 versions should not be affected. (Note: if more than one typedef name is registered, it's indetermine which name gets used) Fixes: QTBUG-96916 Pick-to: 6.3 6.2 Change-Id: I2bbf422288924c198645fffd16a8d811aa58201e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix autotest runtime failures on INTEGRITYTatiana Borisova2021-12-161-1/+1
| | | | | | | | | | | - add test resources to binaries - link Qt::Gui to tst_qpointer for static build case Task-number: QTBUG-99123 Pick-to: 6.2 6.3 Change-Id: I311827b9c641eaf9537091b051c15f9fcbcb9f0c Reviewed-by: Kimmo Ollila <kimmo.ollila@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QNX: Remove expected failPasi Petäjäjärvi2021-12-121-14/+0
| | | | | | | | Works with QCC 8.3.0 (Based GCC 8.3.0 20190222 (stable)) Pick-to: 6.2 Change-Id: I130847627a4b77ced83d196a7a1674963c5cd3e1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove conditioning on Android embeddedEdward Welbourne2021-09-171-1/+1
| | | | | | | | It is no longer handled separately from Android. This effectively reverts commit 6d50f746fe05a7008b63818e77784dd0c99270a1 Change-Id: Ic2d75b8c5a09895810913311ab2fe3355d4d2983 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Add missing dependencies of tests on their helper programsEdward Welbourne2021-09-171-3/+4
| | | | | | | | | | | | | | | | | This ensures that a command such as $ ninja tst_qlocale && ninja tst_qlocale_check will automagically build the syslocaleapp program that the test runs from a subtest. Similar for testlib's selftests and tst_QProcess. As a drive-by, pruned some legacy comments from when CMakeLists.txt files were generated from .pro files. Change-Id: I67691a8175aaef124d4104cf1898193993408bdf Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* tst_QtJson: add matching escape-generating testThiago Macieira2021-09-061-0/+55
| | | | | | | Change-Id: Ie72b0dd0fbe84d2caae0fffd16a11596eb61a90e Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* JSON parsing: fix incorrect sign-extension for decoding bad escapesThiago Macieira2021-09-061-7/+64
| | | | | | | | | | | | | | The parser was lenient in accepting backslashes followed by invalid characters, but accidentally sign-extended everything above 0x7f causing broken outputs that weren't valid UTF-16 either. For example, the sequence "\\\xff" (backslash followed by 0xff) produced sequence "\ud7bf\udfff" (U+D7BF is not a surogate pair). Change-Id: Ie72b0dd0fbe84d2caae0fffd16a113c703a7696f Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* tests: Remove unused SRCDIR definesIevgenii Meshcheriakov2021-08-174-8/+0
| | | | | | | | | | | Remove SRCDIR defines from tests that don't use them. There is a standard define called QT_TESTCASE_SOURCEDIR that is available to all tests and serves the same purpose. Pick-to: 6.2 Change-Id: I2aa237739c011495e31641cca525dc0eeef3c870 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Prefer QFAIL("Informative message") over QVERIFY(false)Edward Welbourne2021-06-141-3/+3
| | | | | Change-Id: I706b0aedfa870452331a8c2c488d55b279ee452a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix BASE argument of qt_add_resourcesJoerg Bornemann2021-05-181-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The BASE argument of qt_add_resources now denotes the root point of the alias of the file. Before, BASE was merely prepended to every file that got passed to qt_add_resources. Old behavior: qt_add_resources(app "images" PREFIX "/" BASE "../shared" FILES "images/button.png") Alias is "../shared/images/button.png", and pro2cmake generated QT_RESOURCE_ALIAS assignments to fix this. New behavior: qt_add_resources(app "images" PREFIX "/" BASE "../shared" FILES "../shared/images/button.png") The alias is "images/button.png". No extra QT_RESOURCE_ALIAS assignment is needed. The new behavior is in effect for user projects and for Qt repositories that define QT_USE_FIXED_QT_ADD_RESOURCE_BASE. Qt repositories will be ported one by one to this new behavior. Then the old code path can be removed. Pick-to: 6.1 Task-number: QTBUG-86726 Change-Id: Ib895edd4df8e97b54badadd9a1c34408beff131f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix compiler warning from int size mismatchVolker Hilsheimer2021-04-291-2/+2
| | | | | | | | Cast consistently to quint8, which is the type we are streaming out in the test. Change-Id: I44d360ca6b75f14e7a2b80962ad249a6f6b1cb31 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Correct prefix reported for end element in QXmlStreamReaderVincent Baijot2021-04-208-13/+13
| | | | | | | | | | | | | | | | | | | Before this change, QXmlStreamReader prefix value was always an empty string for EndElement when the documentation state : "Returns the prefix of a StartElement or EndElement." The error was a missing update of the prefix value when parsing EndElement. I updated the tests data which were also wrong because no prefix were reported even for </a:foo>. No new test is necessary, I think, the test data already cover the cases of EndElement with a prefix and without one (unchanged here). Fixes: QTBUG-86847 Pick-to: 5.15 6.0 6.1 Change-Id: I0ad38b9741d760f1ce688a36f969ec14e20a928c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>