summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/text/qbytearray
Commit message (Collapse)AuthorAgeFilesLines
* QString/QByteArray: add slice() methodsAhmad Samir2024-02-291-0/+27
| | | | | | | | | [ChangeLog][QtCore][QString/QByteArray] Added slice() methods that work like sliced(), but modify the string/byte-array they are called on. Task-number: QTBUG-99218 Change-Id: I3075562983ef123d9aa022a2304c7e774cf2ea42 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Change license for tests filesLucie Gérard2024-02-042-2/+2
| | | | | | | | | | | | 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>
* QString/QByteArray: add lvalue and rvalue overloads of left/mid/rightThiago Macieira2023-10-251-0/+81
| | | | | | | | | | | | The first/last/sliced API may be what we suggest users use, but the vast majority of the installed codebase uses left/mid/right because they've been available since time immemorial. An additional benefit of this is to make left() and right() available as inline methods. Change-Id: Ifeb6206a9fa04424964bfffd1788383817ed906c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QString/QByteArray: fix append() wrt. raw dataMårten Nordheim2023-08-211-0/+15
| | | | | | | | | | | | | | | | | | | | When appending to an empty string or byte array, we optimize and copy the internal pointer. But if the other string/byte array was created with fromRawData this might be temporary data on the stack/heap and might be de-allocated or overwritten before the string/byte array is used or is forced to make a deep-copy. This would lead to incorrect data being used. This is easy to overlook if you plan to append multiple strings together, potentially supplied through an argument. Upon appending a second string it would make a full copy, but there might not be a guarantee for that. So, it's hard for users to avoid this pitfall! Fixes: QTBUG-115752 Pick-to: 6.6 6.5 6.2 Change-Id: Ia9aa5f463121c2ce2e0e8eee8a6c8612b7297f2b Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QByteArray: change append(QByteArray) to match QStringBuilder behaviorAhmad Samir2023-08-031-0/+18
| | | | | | | | | | | | I.e. concatenating a null byte array and an empty-but-not-null byte array should result in an empty-but-not-null byte array. This matches the behavior of QString::append(QString) too. Fixes: QTBUG-114238 Pick-to: 6.6 Change-Id: Id36d10ee09c08041b7dabda102df48ca6d413d8b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QByteArray: remove a unittestAhmad Samir2023-08-031-12/+0
| | | | | | | | | | | | | | | | | | It relied on an implementation detail of operator+=(), that the latter wouldn't just use assignement (e.g. if `this` is empty/null). It also had undefined behavior, when the char array used with fromRawData() went out of, the nested, scope, the code was pointing to a dangling stack pointer. Thanks to Thiago for the explanation in code review. This ties in with further changes in this series, where append() is changed to preserve null-ness; there is no way to preserve null-ness in append() while keeping this unittest passing. Change-Id: I43b9f60db9ce2d471f359f32bcc48e7b4cfceeab Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QByteArray: add trimmed() unittestAhmad Samir2023-07-221-0/+35
| | | | | Change-Id: Ib0e808ea45bb68fb0ec79da2f32959677eae988f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* CMake: Make corelib tests standalone projectsAlexandru Croitor2023-07-051-0/+6
| | | | | | | | | | | | | | | | | | 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>
* QByteArray: add STL-style assign()Dennis Oberst2023-06-021-0/+190
| | | | | | | | | | | | | | | | | Implemented assign() methods for QByteArray to align with the criteria of std::basic_string, addressing the previously missing functionality. This is a subset of the overloads provided by the standard. Reference: https://en.cppreference.com/w/cpp/string/basic_string/assign [ChangeLog][QtCore][QByteArray] Added assign(). Fixes: QTBUG-106199 Change-Id: I899b14d74e8f774face8690303efb8610ead95b5 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* tst_QByteArray: add Qt::StringLiterals to the namespace scopeDennis Oberst2023-06-011-1/+2
| | | | | | | | ... and remove all previous function-level occurrences. Pick-to: 6.5 Change-Id: I90df40922e3aed15efc04e885d9f54c577a948b6 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Corelib: s/Q_OS_MAC/Q_OS_DARWIN/wg except for doc and definitionEdward Welbourne2023-03-201-1/+1
| | | | | | | | | | I got tired of being told off by the inanity 'bot for faithfully reflecting existing #if-ery in new #if-ery. Retain only the documentation and definition of the deprecated define. Change-Id: I47f47b76bd239a360f27ae5afe593dfad8746538 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* qstrncpy: NUL-terminate even when src is nullptrMarc Mutz2023-02-221-0/+3
| | | | | | | | | | | | | | | | | | | | | The goal of this function is to ensure that dst is _always_ NUL-terminated. The only exception is if there's no space to write even one NUL byte, of course, but not when src is nullptr but dst would have space. Update the docs to the new behavior and make them more precise. Fix a test that assumed qstrncpy() would not write to dst for (dst, nullptr, 10). [ChangeLog][QtCore][qstrncpy()] Now NUL-terminates the target buffer even when the source pointer is nullptr, provided the target buffer has space for at least one byte. Pick-to: 6.5 6.4 6.2 5.15 Change-Id: I7806d8c71e260f8f02b79af7b6ce94f23599dd69 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tests: Remove remains of qmake conversion from CMakeLists.txt filesFriedemann Kleint2023-02-171-2/+0
| | | | | | | Pick-to: 6.5 Change-Id: I8d106554bb86ac1ec9bb7a4083de4c376bcbab1d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QString, QByteArray: don't detach in removeIf/erase/eraseif()Ahmad Samir2023-02-091-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | If the object is shared, instead of detaching, copy characters from "this" to a new object except for the chacters that would be erased, this is more efficient than detaching (which would copy the whole data then erase). - Extend tst_QString::removeIf() to catch a corner-case (that I saw with tst_QByteArray::removeIf()). - Add q_uninitialized_remove_copy_if, which works like std::remove_copy_if but for uninitialized memory like q_uninitialized_relocate_n (but copies rather than relocates/moves). With the same static_assert from q_relocate_overlap_n that the type destructor is non-throwing. Added q_uninitialized_remove_copy_if in this commit rather than a separate one so that it's unittested by its usage in eraseIf(). [ChangeLog][QtCore][QString, QByteArray] Removing characters from a currently shared string or byte array is now done more efficiently Task-number: QTBUG-106181 Task-number: QTBUG-106183 Change-Id: Icc0ed31633cef71d482b97e0d2d20d763163d383 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_QByteArray/tst_QString: use new QtMiscUtils::toAsciiUpper()Marc Mutz2022-12-201-1/+1
| | | | | | | | | | | | | | | ... in lieu of <cctype>'s toupper(), which is locale-dependent, and out-of-line. The code doesn't run into the toupper(i) issue in the Türkiye locale, because we don't run tests in that locale and because 'i' is not a valid format specifier, but don't let the next reader of the code guess when the use of toAsciiUpper() provides unambiguous guidance. Task-number: QTBUG-109235 Pick-to: 6.5 Change-Id: I8988f5190441e1ae5cb57370952cda70ca6bb658 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QString, QByteArray: add removeAt/First/Last() convenience methodsAhmad Samir2022-11-161-0/+17
| | | | | | | | | | | Requested in codereview.qt-project.org/c/qt/qtbase/+/441770 [ChangeLog][QtCore][Text] Add removeAt/First/Last() convenience methods to QString and QByteArray Change-Id: I48a803e456e70cc51d51726a5e3aa7c125aedb1c Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QByteArray: move the high-memory-using and slot tests awayThiago Macieira2022-11-054-1103/+0
| | | | | | | | | Otherwise, tst_QByteArray takes 97 seconds on my laptop to run. Makes design iteration difficult. Pick-to: 6.4 Change-Id: I07ec23f3cb174fb197c3fffd17220e6737907415 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QByteArray: add erase() unittestsAhmad Samir2022-11-041-0/+28
| | | | | | | | Basic unitttest and one to verify erase returns iterator, not const_iterator. Change-Id: I44c3b82b4686ff3809648063376f5e36fb7e181d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QByteArray: don't detach in remove()Ahmad Samir2022-11-041-1/+8
| | | | | | | | | | | | | | - If this bytearray isn't shared call d->erase() as needed - if it's shared, instead of detaching, create a new bytearray, and copy all characters except for the ones that would be removed See task for details. Adjust unittest to test both code paths. Task-number: QTBUG-106182 Change-Id: I806e4d1707004345a2472e056905fbf675f765ab Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString, QByteArray: add erase(iterator) methodAhmad Samir2022-11-031-0/+17
| | | | | | Fixes: QTBUG-106182 Change-Id: Idc74cc643b90252838ca1a9ca40a330315da421f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Port qCompress() to zstream/deflate()Marc Mutz2022-10-171-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The zlib convenience API we've been using so far has two problems: - On Windows-64, where sizeof(long) == 4, the use of ulong for sizes meant that we could not compress data compressable on other 64-bit platforms (Unix). While zstream also uses ulong, being a stream API, it allows feeding data in chunks. The total_in and total_out members are only required for gzip compression and are otherwise just informational. They're unsigned, so their overflow does not cause UB. In summary, using zstream + deflate() allows us to compress more than 4GiB of data even on Windows-64. - On all platforms, we always allocated the output buffer in such a way as to accommodate the pathological case of random, incompressible data, so the output buffer was larger than the input. Using zstream + deflate(), we can start with a smaller buffer, then let zlib pick up where it left off when it ran out of output buffer space, saving memory in the common case that compression meaningfully reduces the size. To avoid the first few rounds of reallocations, we continue to use zlib's compressBound() for input less than 256KiB. This completely fixes the compression side of QTBUG-106542 and QTBUG-104972. Pick-to: 6.4 6.3 6.2 Fixes: QTBUG-104972 Fixes: QTBUG-106542 Change-Id: Ia7e6c38403906b35462480fd611b482f05a5c59c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Port qUncompress() to zstream/inflate()Marc Mutz2022-10-161-0/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The zlib convenience API we've been using so far has two problems: - On Windows-64, where sizeof(long) == 4, the use of ulong for sizes meant that we could not uncompress data compressed on other 64-bit platforms (Unix). While zstream also uses ulong, being a stream API, it allows feeding data in chunks. The total_in and total_out members are only required for gzip compression and are otherwise just informational. They're unsigned, so their overflow does not cause UB. In summary, using zstream + inflate() allows us to decompress more than 4GiB of data even on Windows-64. - On all platforms, if the size hint in the header was too short, we'd double the output buffer size and try again, from scratch. Using zstream + inflate(), we still need to reallocate, but we can then let zlib pick up where it left off when it ran out of output buffer space. In all but the most pathological cases, copying the already-decoded data instead of re-decoding it again should be faster, esp. if QArrayData uses realloc() instead of malloc() + free() to grow the buffer. We also now directly allocate at least as much output buffer as we have input, to cut the first few rounds of reallocations when the expectedSize was created, as qCompress still does, using modulo arithmetic mod 4GiB instead of saturation arithmethic. Factor the growing of the output buffer into a wrapper function, flate(), which can be reused when porting qCompress(). This completely fixes the uncompression side of QTBUG-106542 and QTBUG-104972. Pick-to: 6.4 6.3 6.2 Task-number: QTBUG-104972 Task-number: QTBUG-106542 Change-Id: I97f55ea322c24db1ac48b31c16855bc91708e7e2 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Rename tst_QBA::toFromHex()'s longer no-leading-zero data-rowEdward Welbourne2022-10-111-1/+1
| | | | | | | No two data-rows should have the same name. Change-Id: I0e222498ca5bb973f703b7e6bd314fc38bb4db4d Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Rename tst_QBA::movablity() to fix the typoEdward Welbourne2022-10-111-4/+4
| | | | | | | There's an i between b and l, as well as after l. Change-Id: I9252935687e25f1f11aacb11286edf666ff9af8a Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Don't duplicate a column name in tst_QByteArray::movablity_data()Edward Welbourne2022-10-111-3/+1
| | | | | | | | | | | It first added a column, then some rows, then called prependExtended_data(), which expects to be called first in a data function and starts by adding the same column. So put that first and drop the duplicate addition of the column. Change-Id: Ia5cf86f821608e78f0e4872db2b3167ef81cc59e Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Port from container.count()/length() to size()Marc Mutz2022-10-041-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Move QMacAutoReleasePool from qglobal.h to qcore_mac_p.hSona Kurazyan2022-09-011-0/+2
| | | | | | | | And include qcore_mac_p.h where needed. Task-number: QTBUG-99313 Change-Id: Idb1b005f1b5938e8cf329ae06ffaf0d249874db2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-231-1/+1
| | | | | | | Task-number: QTBUG-105718 Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Android: tst_QByteArray::base64_2GiB() times out or gets terminatedAssam Boudjelthia2022-08-181-0/+3
| | | | | | | | | | Android kills this test case which tries to use too much memory, or it times out. Pick-to: 6.4 6.3 6.2 Task-number: QTQAINFRA-4748 Change-Id: Ifce92533d50f4c463ee10fe80e7654ad16172a35 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* tst_qbytearray: remove qCompress_data for QT_NO_COMPRESSMarc Mutz2022-08-151-2/+2
| | | | | | | | | The _data function is useless without its test function (and it's not used in other _data functions). Pick-to: 6.4 6.3 6.2 5.15 Change-Id: I7aa6006ed1a9d89008577b750af4ea717dae237f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add license headers to cmake filesLucie Gérard2022-08-031-0/+3
| | | | | | | | | | | | 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-281-2/+2
| | | | | Change-Id: I9b7404e1d3a78fe0726ec0f5ce1461f6c209e90d Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* QByteArray: fix base64 round-trip w/more than 2GiB dataMarc Mutz2022-07-261-0/+40
| | | | | | | | | | | | | | | | | There was an explicit int cast in fromBase64Encoding() which was never ported to qsizetype and therefore truncated the result. Fix by removing the int cast. Add a test, optimize it for as low memory usage as possible, given we need to work in input and output data each in excess of 2GiB. Fixes: QTBUG-104985 Pick-to: 6.4 6.3 6.2 Change-Id: I9c0924957e62e5cb3003132cd811b8b0315d8ac1 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* tst_QByteArray: fix custom QCOMPARE for QBAs > 2GiBMarc Mutz2022-07-201-1/+1
| | | | | | | | | | | | | | | The tst_QByteArray test redefines the QCOMPARE macro to check the LHS to be NUL-terminated. Because the code was never ported from int to qsizetype, it fails for QByteArrays of size > 2GiB. Fix by porting to qsizetype. Pick-to: 6.4 6.3 6.2 Task-number: QTBUG-104985 Change-Id: Ib3951b0efed5f734ae1324ea2d455bb7762fb9c4 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use SPDX license identifiersLucie Gérard2022-05-162-56/+6
| | | | | | | | | | | | | 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>
* Deprecate _qs and _qba literal operators in favor of _s and _baSona Kurazyan2022-05-021-1/+3
| | | | | | | | | | [ChangeLog][QtCore] Deprecated _qs and _qba literal operators for QString and QByteArray in favor of _s and _ba in the Qt::Literals::StringLiterals namespace. Task-number: QTBUG-101408 Change-Id: I26aee0055e3b4c1860de6eda8e0eb857c5b3e11a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add literal operators for QString/QByteArray to StringLiterals namespaceSona Kurazyan2022-04-071-15/+40
| | | | | | | | | | | | [ChangeLog][QtCore] Added literal operators for _s and _ba for QString and QByteArray respectively in the Qt::Literals::StringLiterals namespace. Task-number: QTBUG-101408 Change-Id: I5cd4e7f36f614ea805cfecc27b91c5d981cd3794 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QByteArray/QVarLengthArray: add missing resize(n, v) overloadsMarc Mutz2022-04-061-0/+18
| | | | | | | | | | | | | | | | | | QList and QString had them, so add them to QByteArray and QVarLengthArray, too. In the QVLA case, we need to jump though a hoop or two to avoid having to duplicate all the reallocation logic. Nothing a few template tricks cannot solve. [ChangeLog][QtCore][QByteArray] Added resize(n, ch) overload. [ChangeLog][QtCore][QVarLengthArray] Added resize(n, v) overload. Fixes: QTBUG-102270 Change-Id: I0d281ae5b574f440f682e4a62427b434dcf5b687 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add QByteArray::percentDecoded() as an instance methodEdward Welbourne2022-03-181-9/+9
| | | | | | | | | | | | | Percent-decoding was previously only present as a static method taking a QBA parameter; it might as well be an instance method of that parameter. Change most QBA tests to use it rather the static method. [ChangeLog][QtCore][QByteArray] percentDecoded() is now available as an instance method of the byte array to be decoded, equivalent to the static QByteArray::fromPercentEncoding(). Change-Id: I982101c44bdac5cc4041e85598d52ac101d38fa1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add some %-encoding round-trip tests that use % in the plain-textEdward Welbourne2022-03-141-1/+9
| | | | | | | | This was not previously tested. Change-Id: Icd287b519f6bc5d450f4490990ac78b0d06774f6 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Deprecate {QString, QByteArray}::count()Sona Kurazyan2022-03-121-0/+5
| | | | | | | | | | | | And remove their uses. [ChangeLog][QtCore][Deprecation Notice] Deprecated QString::count() and QByteArray::count() that take no parameters, to avoid confusion with the algorithm overloads of the same name. They can be replaced by size() or length() methods. Change-Id: I6541e3235ab58cf750d89568d66d3b1d9bbd4a04 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Exclude denormal test cases if system doesn't support itTatiana Borisova2022-02-151-0/+6
| | | | | | | | | | | | - 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-111-14/+0
| | | | | | | | | | | | 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>
* QByteArray: fix isUpper/isLowerGiuseppe D'Angelo2022-01-251-13/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 577d698b8e72bc0969ae7545a1a56d3a3d08bdda changed QString::isUpper / isLower behaviors to match Unicode semantics: a string is uppercase if it's identical to its own toLower/toUpper folding. These semantics come from Unicode so they're not up for debate. That commit however left QByteArray untouched. Generally speaking, we want to move away from QByteArray as "text storage" -- this has partially happened between Qt 5 and Qt 6, where QByteArray went from Latin-1 semantics to ASCII semantics. Still, QByteArray offers toUpper/toLower and isUpper/isLower and all this family of functions should be consistent in behavior. Apply the same fix that was applied to QString. [ChangeLog][Important Behavior Changes] The semantics of QByteArray::isLower() and QByteArray::isUpper() have been changed. Now lowercase (resp. uppercase) byte arrays are allowed to contain any character; a byte array is considered lowercase (resp. uppercase) if it's equal to its own toLower() (resp. toUpper()) folding. For instance, the "abc123" byte array is now considered to be lowercase. Previously, the isLower() (resp. isUpper()) functions checked whether the byte array only contained ASCII lowercase (resp. uppercase) characters, and was at least 1 character long. This had the side effect that byte array containing ASCII non-letters (e.g. numbers, symbols, etc.) were not lowercase nor uppercase. [ChangeLog][QtCore][QByteArray] QByteArray::isLower() and QByteArray::isUpper() now work correctly with empty byte arrays. The semantics of these functions have been changed. Pick-to: 6.3 6.2 Fixes: QTBUG-100107 Change-Id: Id56a42f01b2d1af5387bf0e6ccff0f824f757155 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove unused .qrc filesJoerg Bornemann2022-01-171-5/+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>
* tst_QString/tst_QByteArray: add checks for null-nessMarc Mutz2022-01-131-0/+33
| | | | | | | | | | We want to preserve nullness where possible. Test that various ctors do the right thing when presented with null input. Pick-to: 6.3 Change-Id: Ia1a1d4fb3c919b4fed2d9b87827815a1b5072c54 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QByteArray: fix append() with a negative lengthThiago Macieira2022-01-111-0/+1
| | | | | | | | | | | | The documentation says that if it's negative, we find the null termination. This bug was introduced with the clean up to use QByteArrayView in commit 8897aa071a668563a53a4c2e6909572f1762b1e7. Fixes: QTBUG-99640 Pick-to: 6.3 6.2 Change-Id: Ib42b3adc93bf4d43bd55fffd16c89fa4a960f3a9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* tst_QByteArray: fix UB (signed overflow)Marc Mutz2021-12-161-2/+3
| | | | | | | | | | | | | | | The first case is simple, as it's a static overflow. Theoretically, the compiler would be allowed to just remove the complete function as dead code. This is an error left from the port from int to qsizetype: Qt 5.15 there has uint(MaxAllocSize) + 1, so use quint here again, qint64 is wrong. In the second case, we _may_ reach alloc == MaxAllocSize. Check that, if we do, we don't then add 1 to it. Pick-to: 6.3 6.2 Change-Id: I93044ed6f1b77559642fa1e4e8f313cf59eeeb79 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix autotest runtime failures on INTEGRITYTatiana Borisova2021-12-162-4/+4
| | | | | | | | | | | - 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>
* 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>