summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/serialization
Commit message (Collapse)AuthorAgeFilesLines
* Fix test compilation issues with QtLite configurationJari Helaakoski5 days3-1/+27
| | | | | | | | | | Now developer build tests compile, but some are not working. Functional fix will come later via separate tasks. Task-number: QTBUG-122999 Change-Id: I70487b46c1b32ba4279cb02a4978e4f55ac0d310 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QXmlStreamWriter: fix attempts to write bad QStringsThiago Macieira2024-04-181-0/+20
| | | | | | | | | | | | | We weren't doing the decoding from UTF-16 to UTF-32, so weren't catching invalid code sequences [ChangeLog][QtCore][QXmlStreamWriter] The class now rejects writing UTF-8 and UTF-16 invalid input (improper code unit sequences). Task-number: QTBUG-122241 Pick-to: 6.5 6.6 6.7 Change-Id: I83dda2d36c904517b3c0fffd17b42d17c637fdc4 Reviewed-by: Mate Barany <mate.barany@qt.io>
* QXmlStreamWriter: decode UTF-8 into code pointsThiago Macieira2024-04-181-0/+125
| | | | | | | | | | | | | | | | | | | | | We were iterating over code *units* and that yielded wrong results. The one from the bug report was simply caused by the fact that QUtf8StringView::value_type is char, which is signed on x86, so the expression: *it <= u'\x1F' was true for all non-Latin1 content. But in attempting to fix this, I needed to do the proper UTF-8 decoding, as otherwise we wouldn't catch non-Latin1 sequences and such. [ChangeLog][QtCore][QXmlStreamWriter] Fixed a bug that caused the class to fail to write UTF-8 strings with non-US-ASCII content when passed as a QUtf8StringView. Fixes: QTBUG-122241 Pick-to: 6.5 6.6 6.7 Change-Id: I83dda2d36c904517b3c0fffd17b42bbf09a493d0 Reviewed-by: Mate Barany <mate.barany@qt.io>
* CBOR: fix sorting of UTF16-to-UTF16 stringsThiago Macieira2024-04-121-30/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This amends commit 394788c68efacdec2676988b4b4ff207b20557f2 (its ChangeLog applies to this commit too). That fixed sorting of UTF8-to- UTF16, but when adding more unit tests, I've discovered that some UTF-16 strings also sorted incorrectly. There were two problems: First, we were assuming that we could rely on the UTF-16 length as a proxy for the UTF-8 one, but that's not true for some cases: * both 1-, 2- and 3-codepoint UTF-8 sequences are 1 codepoint in UTF-16, so some strings would have identical UTF-16 length * 4-codepoint UTF-8 sequences shrink to 2-codepoint UTF-16 ones (2:1) but 3-codepoint UTF-8 sequences shrink to 1 (3:1), so some strings would be longer in UTF-16 but shorter in UTF-8. Second, QtPrivate::compareStrings performs UTF-16 codepoint comparisons not Unicode character ones, so surrogate pairs were sorting before U+E000 to U+FFFF. To fix all of this, we need to decode the UTF-16 string into UTF-32 and calculate the length of that in UTF-8 to be sure we have the sorting order right. Since this is a slight behavior change with a performance penalty, I am choosing to backport only to 6.7. The penalty mostly does not apply to 6.8 due to commit 61556627f25e7c7acbfcc5e54127a392b5239977. Pick-to: 6.7 Change-Id: If1bf59ecbe014b569ba1fffd17c4c4ddcc874aac Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Tests: make some QFile::open calls failGiuseppe D'Angelo2024-04-131-3/+4
| | | | | | | | | | In some cases calls to QFile::open are made outside of a testfunction (so we can't use QVERIFY), or even in standalone executables that are executed by tests. Make them fail "visibly". Change-Id: Iec4d56f6d874be16aa2e9ad6974eeec2a98caa3f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCborMap iterators: use new comparison helper macrosTatiana Borisova2024-04-121-0/+19
| | | | | | | | | | | | | | | | | New comparison macros are used for following classes: - QCborMap::Iterator - QCborMap::ConstIterator Replace public operators operator==(), operator!=(), operator!<(), etc of classes to friend methods comparesEqual(), compareThreeWay(); Use *_helper methods to have an access to protected members of QCborValueConstRef class from friend functions. Task-number: QTBUG-120300 Change-Id: I71b6febaf3f31ea7ba668d91c375b0a7b6827d21 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QJsonObject iterators: use new comparison helper macrosTatiana Borisova2024-04-121-0/+22
| | | | | | | | | | | | | | | | | New comparison macros are used for following classes: - QJsonObject::iterator - QJsonObject::const_iterator Replace public operators operator==(), operator!=(), operator!<(), etc of classes to friend methods comparesEqual(), compareThreeWay(); Use *_helper methods to have an access to protected members of QCborValueConstRef class from friend functions. Task-number: QTBUG-120300 Change-Id: I308e2c0a549ff186c1d6339b38e989b80dc388a3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCborArray iterators: use new comparison helper macrosTatiana Borisova2024-04-101-0/+29
| | | | | | | | | | | | | | | | | New comparison macros are used for following classes: - QCborArray::Iterator - QCborArray::ConstIterator Replace public operators operator==(), operator!=(), operator!<(), etc of classes to friend methods comparesEqual(), compareThreeWay(); Use *_helper methods to have an access to protected members of QCborValueRef class from friend functions. Task-number: QTBUG-120300 Change-Id: Ie8ffef3e2278dfbf2bf0b32c30a7bf98d99fd1c3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_QCborValue: merge sorting() and comparison() testsThiago Macieira2024-04-081-91/+124
| | | | | | | | Drive-by add NaN value for testing. Change-Id: I5f663c2f9f4149af84fefffd17c035f099d01d55 Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* QCborValue: fix sorting of UTF8-to-UTF16 stringsThiago Macieira2024-04-081-0/+36
| | | | | | | | | | | | | We must compare the raw string length in UTF-8, not the UTF-16 one. [ChangeLog][QtCore][QCborValue] Fixed a bug that caused certain non-US-ASCII string comparisons to produce results not in line with the CBOR specifications. Pick-to: 6.5 6.6 6.7 Change-Id: I5f663c2f9f4149af84fefffd17c05d1c0f1bbc3a Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* Add equality comparison between QJsonObject and QJsonValueConstRefTatiana Borisova2024-04-031-0/+3
| | | | | | | | - amends 839cffd5212cc1437661e9c650eb2ff4b19fa4e8 Fixes: QTBUG-123927 Change-Id: I9174e747478937d4c9ed6522dd603fea50daf203 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Tests: check the output of QFile::openGiuseppe D'Angelo2024-03-274-18/+19
| | | | | | | | | | Wrap the call in QVERIFY. tst_QTextStream::read0d0d0a was also faulty as it *never* opened the file because of a broken path. Fix it with QFINDTESTDATA. Change-Id: I61a8f83beddf098d37fda13cb3bfb4aaa4913fc5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCborMap: add missing comparator to QCborValueConstRefThiago Macieira2024-03-261-2/+10
| | | | | | | | | And ensure all combination of CBOR types are tested. Amends e5ebb9022ab9e00ab01d0bce527755da77083217 Change-Id: I5f663c2f9f4149af84fefffd17c02d352cd41f3f Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
* QPolygonF: delegate QDataStream marshalling to QListThiago Macieira2024-03-261-12/+23
| | | | | | | | | | | | | | Like the QPolygon code. This fixes a mistake in failing to clear the list before de-marshalling in operator>>. Updated most of the QDataStream tests to have data in the objects they're streaming into, to ensure that the stream overwrites everything. Fixes: QTBUG-122684 Task-number: QTBUG-122704 Pick-to: 5.15 6.5 6.6 6.7 Change-Id: I01ec3c774d9943adb903fffd17b6920c72f5042b Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QJsonArray iterators: use new comparison helper macrosTatiana Borisova2024-03-261-0/+35
| | | | | | | | | | | | | | | | New comparison macros are used for following classes: - QJsonArray::iterator - QJsonArray::const_iterator Replace public operators operator==(), operator!=(), operator!<(), etc of classes to friend methods comparesEqual(), compareThreeWay(); Use *_helper methods to have an access to protected members of QCborValueConstRef class from friend functions. Task-number: QTBUG-120300 Change-Id: I9b41b619107ce69d8b6dab4938232fab841aab51 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QJsonObject: use new comparison helper macrosTatiana Borisova2024-03-251-1/+21
| | | | | | | | | | | | | | | | | Replace public operators operator==(), operator!=() of QJsonObject to friend methods comparesEqual(). Use QT_CORE_REMOVED_SINCE and removed_api.cpp to get rid of current comparison methods and replace them with a friend. Add friend method comparesEqual(QJsonObject, QJsonValue) to the QJsonObject class, to support comparison between QJsonObject and QJsonValue elements, see test-case valueEquals(). Task-number: QTBUG-120300 Change-Id: Ibab0b4b39966205447e31c41e94e7e1a4e31e553 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* QJsonValue: use new comparison helper macrosTatiana Borisova2024-03-221-35/+49
| | | | | | | | | | | | | | | | | | Replace public operators operator==(), operator!=() of QJsonValue/QJsonValueConstRef/QJsonValueRef classes to friend methods comparesEqual(). Use QT_CORE_REMOVED_SINCE and removed_api.cpp to get rid of current comparison methods and replace them with a friend. Delete non-exported public operators operator==(), operator!=() for QJsonValueConstRef/QJsonValueRef classes. Add comparison check to auto-test. Task-number: QTBUG-120300 Change-Id: I01434af4ce5a7589733db4a9b14f54ad42e852ed Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* QJsonDocument: use new comparison helper macrosTatiana Borisova2024-03-221-3/+20
| | | | | | | | | | | | | Replace public operators operator==(), operator!=() of QJsonDocument to friend methods comparesEqual(). Use QT_CORE_REMOVED_SINCE and removed_api.cpp to get rid of current comparison methods and replace them with a friend. Task-number: QTBUG-120300 Change-Id: I7b61765c34406b7a9fb7dd8b1fc554c87af6a3f3 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QJsonArray: use new comparison helper macrosTatiana Borisova2024-03-212-0/+41
| | | | | | | | | | | | | | | | | Replace public operators operator==(), operator!=() of QJsonArray to friend methods comparesEqual(). Use QT_CORE_REMOVED_SINCE and removed_api.cpp to get rid of current comparison methods and replace them with a friend. Add friend method comparesEqual(QJsonArray, QJsonValue) to the QJsonArray class, to support comparison between QJsonArray and QJsonValue elements, see test-case fromToVariantConversions() Task-number: QTBUG-120300 Change-Id: I8440ca0761bede8551ff792bfa7f22e47b56fa79 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Xml: use new comparison helper macrosTatiana Borisova2024-03-202-2/+77
| | | | | | | | | | | | | | | | | | | | | | New comparison macros are used for following classes: -QXmlStreamAttribute -QXmlStreamNamespaceDeclaration -QXmlStreamNotationDeclaration -QXmlStreamEntityDeclaration Replace public operators operator==(), operator!=() of classes to friend methods comparesEqual(); Use QT_CORE_REMOVED_SINCE to get rid of current comparison methods and replace them with a friend. Add checkStreamNotationDeclarations()/checkStreamEntityDeclarations() test-cases to test change. Task-number: QTBUG-120300 Change-Id: I0b5642b2e23cc21ede7bc4888f0a9bddd6c08d07 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCborMap: use new comparison helper macrosTatiana Borisova2024-03-201-150/+169
| | | | | | | | | | | | | | | | | | | | | | Replace public operators operator==(), operator!=(), operator<() of QCborMap to friend methods comparesEqual() / compareThreeWay(). Use QT_CORE_REMOVED_SINCE to get rid of current comparison methods and replace them with a friend. Delete #if 0 && __has_include(<compare>) blocks, since they are not required anymore. Add friend methods comparesEqual(QCborMap, QCborValue) and compareThreeWay(QCborMap, QCborValue) to the QCborMap class, to support comparison between QCborMap and QCborValue elements, see test-case mapSelfAssign() -> QT_TEST_EQUALITY_OPS(it.key(), QCborMap({{0, v}}), true); Task-number: QTBUG-120300 Change-Id: I9e33df255d16484efd3124cf0632db859408fb5d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* QCborArray: use new comparison helper macrosTatiana Borisova2024-03-191-34/+51
| | | | | | | | | | | | | | | | | | | | | | | Replace public operators operator==(), operator!=(), operator<() of QCborArray to friend methods comparesEqual() / compareThreeWay(). Use QT_CORE_REMOVED_SINCE to get rid of current comparison methods and replace them with a friend. Delete #if 0 && __has_include(<compare>) blocks, since they are not required anymore. Add friend methods comparesEqual(QCborArray, QCborValueConstRef) and compareThreeWay(QCborArray, QCborValueConstRef) to QCborArray to support comparison between QCborArray and QCborValueRef/QCborValueConstRef, see test-case mapMutation(). Add QT_TEST_EQUALITY_OPS/QT_TEST_ALL_COMPARISON_OPS tests for QCborArray test-cases. Task-number: QTBUG-120300 Change-Id: Ifad1a04c61363618e8bba73cf7c87757552d722a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCborValueConstRef/QCborValueRef: use new comparison helper macrosTatiana Borisova2024-03-191-7/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | Replace public operators operator==() and operator!=() of QCborValueConstRef and QCborValueRef classes to friend methods comparesEqual(). Replace public operator<() of QCborValueConstRef and QCborValueRef classes to friend methods compareThreeWay() respectively. Use QT_CORE_REMOVED_SINCE to get rid of current comparison methods and replace them with a friend. Delete #if 0 && __has_include(<compare>) blocks, since they are not required anymore. Add comparison() test-case for QCborValueConstRef/QCborValueRef testing. Add QCborValue::operator==()/QCborValue::operator!=()/ QCborValue::operator<() and QCborValueRef::operator==()/ QCborValueRef::operator!=()/QCborValueRef::operator<() operators to the removed_api file. Task-number: QTBUG-120300 Change-Id: I2e8e4e32b7b5b49da321364cc12986e9c64b5f37 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCborValue: use new comparison helper macrosTatiana Borisova2024-03-132-56/+46
| | | | | | | | | | | | | | | | | | | Replace public operators operator==() and operator!=() of QCborValue to friend method comparesEqual(). Replace public operator<() of QCborValue to friend method compareThreeWay(). Use QT_CORE_REMOVED_SINCE to get rid of current comparison methods and replace them with a friend. Delete #if 0 && __has_include(<compare>) blocks, since they are not required anymore. Task-number: QTBUG-120300 Change-Id: I884ff6ce2a71618b0e3eaa907f0852f93c2a073c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* QCborStreamReader: rename toStringish() -> readAllStringish()Ivan Solovev2024-03-121-3/+3
| | | | | | | | | | | | Amends 8af346c1f66f813c3c8fe4d8b892ecfbe96eacfb and 1d9137e13f9eb3f183c967e9e911c5b260f93dc0. Found in 6.7 API review Task-number: QTBUG-123115 Pick-to: 6.7 6.7.0 Change-Id: I98d79274f26f3439302a59181401b6e244fe5202 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCborStreamReader: rename appendToType() -> readAndAppendToType()Ivan Solovev2024-03-121-6/+6
| | | | | | | | | | | | Amends ff034ebbfa7c1cc47cdcc15bc854972cd960db1a. Found in 6.7 API review Task-number: QTBUG-123115 Pick-to: 6.7 6.7.0 Change-Id: Id5e95aacffcb633701d4d635d2bf8af70984903e Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Correct license for tools filesLucie Gérard2024-03-051-1/+1
| | | | | | | | | | | | According to QUIP-18 [1], all tools file should be LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: Icd5d5be2e04819617e68ff142924de1773bebbad Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* QCborStreamReader: rename toType(Type&) -> appendToType(Type&)Ivan Solovev2024-02-291-6/+6
| | | | | | | | | | | | | | | Rename the toType() overloads taking an out-parameter to appendToType(), because that gives a better understanding of the usecase. Found in 6.7 API review Amends 8af346c1f66f813c3c8fe4d8b892ecfbe96eacfb and 1d9137e13f9eb3f183c967e9e911c5b260f93dc0. Pick-to: 6.7 Change-Id: Ic1a462e9507123a59e6086bfb48b8b61ab79abb8 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Containers: add max_size()Giuseppe D'Angelo2024-02-272-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One more method for STL compatibility. This one is particularly subtle as it's required by the `reservable-container` concept: https://eel.is/c++draft/ranges#range.utility.conv.general-3 Without this concept, ranges::to won't reserve() before copying the elements (out of a sized range which isn't a common_range). Implementation notes: there were already a couple of constants denoting the maximum QByteArray and QString size. Centralize that implementation in QTypedArrayData, so that QList can use it too. The maximum allocation size (private constant) needs a even more central place so that even QVLA can use it. Lacking anything better, I've put it in qcontainerfwd.h. Since our containers aren't allocator-aware, I can make max_size() a static member, and replace the existing constants throughout the rest of qtbase. (I can't kill them yet as they're used by other submodules.) [ChangeLog][QtCore][QList] Added max_size(). [ChangeLog][QtCore][QString] Added max_size(). [ChangeLog][QtCore][QByteArray] Added max_size(). [ChangeLog][QtCore][QVarLengthArray] Added max_size(). Change-Id: I176142e31b998f4f787c96333894b8f6653eb70d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Deprecate QDataStream::readBytes(char *&, uint &) instead of removing itIvan Solovev2024-02-071-0/+18
| | | | | | | | | | | | | | | | | | | | | | We cannot remove the overload using QT_REMOVED_SINCE, because a qint64 lvalue in the new overload will not bind to an uint& parameter, so the old code would not compile. Deprecate the old overload, and add a unit-test that makes sure that it still behaves correctly. This commit also introduces the new deprecation macros that are required to do the deprecation in Qt 6.11. Amends fd48ce0b73c74dafd5db27bc1f2752ef665df7ef Found in 6.7 API review Pick-to: 6.7 Change-Id: I02893bfbe040df736f8e746384e0261a0f0041d3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDataStream: use SizeLimitExceeded status in write operationsIvan Solovev2024-02-071-0/+14
| | | | | | | | | | | | | | | | | | | | | | Set this status when the stream tries to write more data than the current serialization format supports. Update the methods that write containers to return early if they fail to write the container size, and do not try to serialize the elements. Convert the manual tst_manualqdatastream test into a data-driven test, allowing us to specify various stream versions. Adjust the test code to check that the SizeLimitExceeded status is set when the stream version is <= Qt_6_6. Amends fd48ce0b73c74dafd5db27bc1f2752ef665df7ef Found in 6.7 API review Pick-to: 6.7 Change-Id: If4c62ea53ac9bccd423f00f0f03afd6ba6bdc4f5 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDataStream: use qint64 to represent size while reading and writingIvan Solovev2024-02-071-2/+2
| | | | | | | | | | | | Do that to avoid narrowing at the call site on 32-bit platforms. Amends fd48ce0b73c74dafd5db27bc1f2752ef665df7ef Found in 6.7 API review Pick-to: 6.7 Change-Id: I31142399385521d973b2ed3789745569e44d5d63 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Change license for tests filesLucie Gérard2024-02-0416-16/+16
| | | | | | | | | | | | According to QUIP-18 [1], all tests file should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I9657df5d660820e56c96d511ea49d321c54682e8 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* QBitArray: fix potential truncation in QDataStream op>>()Marc Mutz2024-01-311-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | In Qt 5, a QBitArray could not contain more than INT_MAX bits, because the then-size_type, int, cannot represent more, even if the underlying storage could hold 8x as much, and the serialisation format, using unsigned int, could represent 2x. Therefore, reject old formats with sizes that exceed INT_MAX elements as corrupt. Likewise, the Qt 6 serialisation format unconditionally uses 64-bit sizes, but 32-bit platforms still cannot represent more than numeric_limits<qsizetype>::max() (= INT_MAX) bits in memory. This is a valid stream for 64-bit platforms, though, so ideally, this should be using SizeLimitsExeeded, which, however, is only available from Qt 6.7. So, for now, and until we have SizeLimitsExeeded, mark the stream as corrupt here, too. [ChangeLog][QtCore][QBitArray] Fixed undetected overflows in the deserialisation (opertor>>()) from QDataStream. Pick-to: 6.7 6.6 6.5 6.2 5.15 Change-Id: Ib24cf9218c06a3a05185723c77d4313611c2dd40 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDataStream: add a new SizeLimitExceeded status codeIvan Solovev2024-01-261-2/+2
| | | | | | | | | | | | | | | | | | This status is supposed to be used when the stream tries to read or write more data than it is supported by the current platform. For example, reading more than 2 GiB of data on a 32-bit platform will result into this status, but it will work fine on a 64-bit platform. This patch uses the new status in read operations. Amends fd48ce0b73c74dafd5db27bc1f2752ef665df7ef Found in 6.7 API review Pick-to: 6.7 Change-Id: I675b1ee25fafba174ce8f94c3470dbb7893d6d9e Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Tests: remove blacklisted CIs no longer availableChristian Ehrlicher2023-12-061-2/+0
| | | | | | | | | | | | | | | | Remove the following CIs from BLACKLIST files as they are no longer used: - msvc-2015 - msvc-2017 - windows-7sp1 - opensuse-42.3 - ubuntu 16.04/18.04/20.04 - rhel 6.6/7.4/7.6 - redhatenterpriselinuxworkstation-6.6 Change-Id: Ief9550e3455a1ed211d978933262c8d5557b0fec Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QCborStreamReader: add UTF-8 reading APIThiago Macieira2023-11-241-0/+44
| | | | | Change-Id: I8bd6bb457b9c42218247fffd1797605d1687b0dc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QCborStreamReader: add toString() and toByteArray()Thiago Macieira2023-11-241-0/+41
| | | | | | | | | | | | | | | They've been a long time coming. I had them in TinyCBOR before the chunked reading; in fact, I added the chunked reading specifically for Qt's CBOR support. [ChangeLog][QtCore][QCborStreamReader] Added toString() and toByteArray(), which read a full string whether it is chunked or not. They also guard against attempting to allocate more memory than the underlying stream could provide. Change-Id: Icfe44ecf285a480fafe4fffd174c5815f153d5b5 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* wasm tests: Disable unstable qcborvalue testPiotr Wierciński2023-11-231-1/+3
| | | | | Change-Id: Idd22897a7ecb4c5e28d60acf390d65517f89c05a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* wasm: Fix test runner for asynchronous testsPiotr Wierciński2023-10-261-1/+1
| | | | | | | | | | | | | | | | | Test runner was not properly handling tests which return the control back to browser event loop. It was treating such tests as if they exited with code 0, marking them as succesfull even if they were eventually failing or hanging. This commit adds a callback to TestCase so the runner is notified when a test truly has finished. As a side effect, two tests need to be disabled for now as they are failing for wasm, which was not properly detected previously. Change-Id: I0eb9383e5bb9cd660431c18747b9e94413629d1e Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Add support for containers > 4 Gi elements in QDataStreamØystein Heskestad2023-10-231-7/+15
| | | | | | | | | | | | The format is changed from 6.7 to support more than UINT32_MAX - 1 elements. The format used to have a quint32 size. Now if the size is larger or equal to 0xfffffffe (2^32 -2) the old size is an extend value 0xfffffffe followed by one quint64 with the actual value. The 32 bit size with all bits set is still used as null value. Fixes: QTBUG-105034 Change-Id: I62188be170fe779022ad58ab84a54b1eaf46e5d9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix renamed and duplicated namespaces in QXmlStreamWriterØystein Heskestad2023-09-201-0/+16
| | | | | | | | | | | | | | | The XML stream writer previously added namespace declarations with the same URL as existing ones, but new names, and renamed the XML elements to use the new namespaces instead of the existing ones. [ChangeLog] Fix renamed and duplicated namespaces in QXmlStreamWriter. Pick-to: 6.5 6.6 Fixes: QTBUG-75456 Change-Id: I90706e067ac9991e9e6cd79ccb2373e4c6210b7b Done-With: Philip Allgaier <philip.allgaier@bpcompass.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Rename accent color in QPaletteSanthosh Kumar2023-08-181-2/+2
| | | | | | | | | | Accent color role has been renamed according to name rule of other color roles in QPalette. Fixes: QTBUG-116107 Pick-to: 6.6 Change-Id: I70ac98a1e97afbdc7ea5f8d79f808c307e170712 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QXmlStreamReader::readNextStartElement() - return false on document endAxel Spoerl2023-08-151-0/+4
| | | | | | | | | | | | | | | | | | | | | | | The method reads the next element in a loop, as long as valid elements exist. Within the loop, it returns - false if the end of an element has been reached - true if a new element has started When the document end has been reached, the loop continues, until readNext() returns Invalid. Then, PrematureEndOfDocumentError is launched. This is wrong, because reading beyond the document end is caused by a missing return condition in the loop. => Treat document end like element end and return false without reading beyond it. => Test correct behavior in tst_QXmlStream::readNextStartElement() Fixes: QTBUG-25944 Pick-to: 6.6 6.5 6.2 Change-Id: I0160b65880756a2be541e9f55dc79557fcb1f09f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* CI: Enable tests under corelib/serialization for Wasm platformPiotr Wierciński2023-08-149-9/+19
| | | | | | | Add more tests on WebAssembly platform for better tests coverage. Change-Id: Iaaaa824ae6058a9ae5dba4c4038a7f687bfc17e0 Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
* tst_QXmlStream: Remove stray commentAxel Spoerl2023-07-251-1/+0
| | | | | | | | Remove stray comment at the end of tst_qxmlstream.cpp Pick-to: 6.6 Change-Id: I88550e2b75194e7895d8578ca0e8350af59d4dfe Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* tst_QXmlStream: Fix CMakeLists.txtAxel Spoerl2023-07-181-1/+1
| | | | | | | | Remove non existing path from GLOB_RECURSE statement. Pick-to: 6.6 6.5 6.2 Change-Id: Ie122bd062acf8cc26f2ddead808c101af4da9573 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* tst_QXmlStream::tokenErrorHandling() - register test directory in CMakeAxel Spoerl2023-07-112-3/+10
| | | | | | | | | | | | | | Register the directory tokenError in the build system to expose it to embedded devices / for cross compiling. Do not fail the test function, when a test file isn't found. The tested functionality is platform independent and will be tested on other platforms. Task-number: QTBUG-92113 Task-number: QTBUG-95188 Pick-to: 6.6 6.5 6.2 5.15 Change-Id: I885d8fdfbbf8ec60e6326bfd871fa85a4390247d Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* QXmlStreamReader: Raise error on unexpected tokensAxel Spoerl2023-07-104-0/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QXmlStreamReader accepted multiple DOCTYPE elements, containing DTD fragments in the XML prolog, and in the XML body. Well-formed but invalid XML files - with multiple DTD fragments in prolog and body, combined with recursive entity expansions - have caused infinite loops in QXmlStreamReader. This patch implements a token check in QXmlStreamReader. A stream is allowed to start with an XML prolog. StartDocument and DOCTYPE elements are only allowed in this prolog, which may also contain ProcessingInstruction and Comment elements. As soon as anything else is seen, the prolog ends. After that, the prolog-specific elements are treated as unexpected. Furthermore, the prolog can contain at most one DOCTYPE element. Update the documentation to reflect the new behavior. Add an autotest that checks the new error cases are correctly detected, and no error is raised for legitimate input. The original OSS-Fuzz files (see bug reports) are not included in this patch for file size reasons. They have been tested manually. Each of them has more than one DOCTYPE element, causing infinite loops in recursive entity expansions. The newly implemented functionality detects those invalid DTD fragments. By raising an error, it aborts stream reading before an infinite loop occurs. Thanks to OSS-Fuzz for finding this. Fixes: QTBUG-92113 Fixes: QTBUG-95188 Pick-to: 6.6 6.5 6.2 5.15 Change-Id: I0a082b9188b2eee50b396c4d5b1c9e1fd237bbdd Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* CMake: Make corelib tests standalone projectsAlexandru Croitor2023-07-059-0/+54
| | | | | | | | | | | | | | | | | | Add the boilerplate standalone test prelude to each test, so that they can be opened with an IDE without the qt-cmake-standalone-test script, but directly with qt-cmake or cmake. Boilerplate was added using the following scripts: https://git.qt.io/alcroito/cmake_refactor Manual adjustments were made where the code was inserted in the wrong location. Task-number: QTBUG-93020 Change-Id: I28b6d3815c5f43d2c33ea65764f6f3f8f129eaf3 Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>