summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
Commit message (Collapse)AuthorAgeFilesLines
* QCache: when overwriting, store the new cost instead of the deltaMårten Nordheim2021-01-141-0/+14
| | | | | | | | | | | | The delta was clearly intended to be used on the total (and still is) but it also wound up getting stored in the cache, which wouldn't be a big problem unless the object was removed, in which case we could incidentally 'free up more space' than intended. Change-Id: Ib2b0f072d30da6d16a93dce60e4c5f6080c109fc Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit d2e2d0d3a6249ccbc17ec92acb32fec9a0d71807) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Android: exclude tst_QFile::moveToTrash on AndroidAssam Boudjelthia2021-01-121-0/+3
| | | | | | | | | | | | The Android tests were marked insignificant for some days, due to an emulator issue, these tests slipped during that time. Exclude them now to bring Android tests back. Task-number: QTBUG-89398 Change-Id: Ia65a0ae8d7474fd2554dda299a60371dbbc9dddb Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit b036ca33475a45298e383aa0d42f072d21e5a9df) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Change QLineF::setLength() to work whenever length() is non-zeroEdward Welbourne2021-01-061-7/+7
| | | | | | | | | | | | | | | | | Previously it only worked when isNull() was false, which is true for very short lines, even though length() may be non-zero. [ChangeLog][QtCore][QLineF] QLineF::setLength() will now set the length if the line's length() is non-zero. Previously, it was documented to only set the length if isNull() was false; this is a fuzzy check, so isNull() could be true for a line with non-zero length(). Fixes: QTBUG-89569 Change-Id: I803e622ad09c85815dde25df8dd3ba6dfcba0714 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 6974737695eae5a41bc8a3f344a4f1f199006f21) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QMultiHash::equal_range crashesZhang Yu2021-01-061-0/+7
| | | | | | | | | | | | | QMultiHash::equal_range crashes when called in a const member function. The Data `d` is a NULL pointer when calling equal_range() before inserting data into an empty QMultiHash. Then calling`d->find` crashes. Fixes: QTBUG-89687 Change-Id: I10c3d196cbc72aed8c8c922ef16534bba51037b7 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 22416ecaaf58619c716229b71cdca558fda0a861) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update shared-mime-info to the 2.1 release, adjust implementationDavid Faure2021-01-051-11/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The spec hasn't changed, but I made the same mistake in xdgmime (the reference implementation) and in Qt: when multiple globs match, and the result from magic sniffing is unrelated to any of those globs, then I used the magic result, but that's wrong, globs have priority and one of them should be picked up. This is now fixed in xdgmime (https://gitlab.freedesktop.org/xdg/xdgmime/-/merge_requests/3) and in the expected results in shared-mime-info (https://gitlab.freedesktop.org/xdg/shared-mime-info/-/merge_requests/99) which this commit is also tested against. This change also optimizes QMimeBinaryProvider::addFileNameMatches to have the same logic as xdgmime for glob matching: literals > extensions > other globs As soon as one category matches, we can stop there. This makes no difference in the overall results, in practice. The user bug report (against the Qt implementation, actually) is https://gitlab.freedesktop.org/xdg/shared-mime-info/-/issues/138 as well as https://bugs.kde.org/show_bug.cgi?id=411718 Change-Id: Ia0a34080427daff43c732609443ee6df8f41447c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 0cbbba2aa5b472241d45b4be6959a792062fbc30) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add test creating QDateTime in double-DST gap in 1947 GermanyAndreas Buhr2020-12-241-0/+9
| | | | | | | | | | | | In 1947, Germany had not only a summer time but also a "Hochsommerzeit", a high summer time. This patch adds a test creating a QDateTime in the time gap at the beginning of this Hochsommerzeit on May 11, 1947. Change-Id: Ib81a23914965f092c3e3195e4c7258e5a4e0b30e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 741862875c4bd72ba6d28cf53f6f88579602e4bf) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Blacklist tst_QDeadlineTimer::stdchrono on Windows/clangFriedemann Kleint2020-12-211-0/+2
| | | | | | | | | It has been failing consistently, recently. Change-Id: I71b2e8857c3d5ce86ad17864c95aac7265ed9a8a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit ec7eb1eab157ae84992ca20653f48394bb066340) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix crash on reallocateAndGrowMichal Klocek2020-12-211-0/+57
| | | | | | | | | | | | | | | | | | | After 6be398 few tests fail/crash with qtcharts. Fix issue on reallocateAndGraw and avoid accessing flags on invalid header. Data::allocate can return invalid header and dataptr, which takes place if capacity is 0. In code before 6be398 clone method checks if header is not null before resetting flags. However after b76fbb4 resetting flags is no longer needed since it is done in allocateGrow. Task-number: QTBUG-89092 Change-Id: I2fde781dad7a0694a5f17ab716f647c2e35f4ff0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit b770b7517d30dd17d1096a0bb434677a2b3ff630) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QCache: fix updating entries breaking the internal chainMårten Nordheim2020-12-171-0/+17
| | | | | | | | | | | | | | | After f08492c6fd9818c7d80b1725355453e179b4d85b was merged this bug would manifest as an entry appearing twice in the chain when a updating an existing entry (insert with an existing key). This could sometimes result in crashes later as the list filled up and the list was used in trim() to remove various entries. Fixes: QTBUG-89176 Change-Id: Ide80160fb4317dc0aefe79eec5dce7ec6813e790 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 0ca46358321f2244386b0b6558a915cda8c6c006) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Restore previous QDateTime behavior in DST gapAndreas Buhr2020-12-171-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Historic QDateTime behavior when being asked to create a QDateTime in the DST gap was to interpret the given date as if it was in the time before that gap, mapping it to a point in time after the gap. This has changed with a04411119ead3d4473e4f0ac4bceedc585977b2f . Since then, the given date is interpreted as if it was in the time after the gap, thus being mapped to a point in time before the gap. This patch restores the historic behavior. This was not caught by Coin because machines ran in timezone "Atlantic/Reykjavik" which does not have DST since 1967. This patch changes tests to always run in "Europe/Oslo". Driveby: Test function "findSpring" did some operations in local time, even though being asked to work in a specific time zone. Fixed that. Fixes: QTBUG-86960 Fixes: QTBUG-89208 Change-Id: Iecce5898bf9711a10e7dfc0a25e4bbeaed1c8ade Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 3d785249ba43cf4bd895ed679bac2791e0130dc5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Regenerate projects using pro2cmake one last timeAlexandru Croitor2020-12-108-12/+40
| | | | | | | | | | And fix up some wrong qmake project files Change-Id: I66cb82aeb9c1419a74df1a650fa78a511ade7443 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 2304acab5ff3bd3832c2e388cfdab27f2a95caa8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QString::lastIndexOf: fix off-by-one for zero length matchesGiuseppe D'Angelo2020-12-101-1/+1
| | | | | | | | | | | | Otherwise, it would report that lastIndexOf of an empty pattern in an empty string doesn't exist. Next commit adds extensive autotests; for now, disable a broken autotest (which already features a comment about why it's broken). Change-Id: I9a0e5c0142007f81f5cf93e356c8bd82f00066f7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit be83ff65c424cff1036e7da19d6175826d9f7ed9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QUrl: fix parsing of empty IPv6 addressesThiago Macieira2020-12-101-0/+2
| | | | | | | | | There's an assertion. Found by Google fuzz scan of CBOR data. Change-Id: I55083c2909f64a1f8868fffd164f1ff3af71605b Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit 4a1091f489ac3fee9efd81b0f1ffca4275725610) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QProperty: Handle eager binding calling setBindingFabian Kosmale2020-12-091-5/+16
| | | | | | | | | | | | | | | | | | When an eager binding triggers a setBinding call, we end up with a special kind of binding loop: setBinding() -> evaluate -> notifyObserver ^ | | / ---------------------------- We now catch set condition, and set the binding status to BindingLoop (with a distinct description). Task-number: QTBUG-87153 Task-number: QTBUG-87733 Change-Id: I9f9915797d82eab820fc279baceaf89d7e5a3f4a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit ddc585b7c773786045f3658d7da5425ed2f2f786) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QCborValue & QCborStreamReader tests: fix warning about %llx on 32-bitThiago Macieira2020-12-081-6/+6
| | | | | | | | | | | | | | | | | cborlargedatavalidation.cpp:93:60: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘qsizetype’ {aka ‘int’} [-Wformat=] 93 | QTest::addRow("bytearray-too-big-for-qbytearray-%llx", v) | ~~~^ ~ | | | | | qsizetype {aka int} | long long unsigned int | %x The cast to size_t is required to make the 64-bit not complain due to the long vs long long difference. Change-Id: I00b01c01a66748508ea1fffd164a9add2a2650cf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 017e41bb8671ed273fffcd2899c3e963d4dd9445)
* tst_QCborValue: adjust the size of the minimum string that won't fitThiago Macieira2020-12-081-1/+3
| | | | | | | | | | I don't know which of the previous commits caused this: as far as I can tell, this test should never have passed. Change-Id: I55083c2909f64a1f8868fffd164e7e8c24eec1f8 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 3c88728b5367f9705a8ff6f62fa66d9f46880084) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QCborStreamReader::next: don't allocate too much memory in a QBAThiago Macieira2020-12-082-12/+19
| | | | | | | | | | | | | | | | | | | | | Because CBOR strings are encoded in UTF-8, it's possible that the string that won't fit a QString in UTF-16 would still fit QByteArray in UTF-8 (e.g., anything US-ASCII and most Latin text). The previous solution was an improvement because we used to read into a QByteArray then convert the QByteArray to QString, thus using 3x the amount of memory (1x in QByteArray, 2x in QString). The previous commit skipped the middle allocation and made the regular readString() function do the decoding either directly on source memory or by reading in small chunks (16 kB). Future improvement for Qt 6.1: add readStringChunk(char16_t *, qsizetype) so we can do the validation / skipping at O(1) memory. Change-Id: I7b9b97ae9b32412abdc6fffd1645458c655cc566 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 58bea7f3a2d0a88a56793c3878a7fcef74b4c646) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QCborValue: avoid allocating result if data is insufficientThiago Macieira2020-12-082-10/+11
| | | | | | | | | | | | Similar to the previous commit which applied to QCborStreamReader, don't allocate too much data before checking that the stream actually has that much. Fixes: QTBUG-88256 Change-Id: I7b9b97ae9b32412abdc6fffd16454b7568a063ba Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 638171eb10cfb186a6c47ec052a3b0c5b6449386) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QCborStreamReader: avoid allocating result if data is insufficientThiago Macieira2020-12-083-8/+13
| | | | | | | | | | | | | | | | | | | | | | | | By calling the internal readStringChunk() function with a QByteArray pointer, QCborStreamReader::readByteArray() can now avoid allocating the resulting buffer until the internals have confirmed that there is sufficient data in the incoming buffer. As a result, we first detect the EOF condition before we conclude the payload would have been too big for QByteArray (validation()) test. Meanwhile, the hugeDeviceValidation() test ends up with a few conditions where it would have copied 1 GB of data, so limit that too. We make a choice of reporting OOM vs DataTooLarge only if QByteArray fails to allocate in the first place (QByteArray::resize() -> Q_CHECK_PTR -> qBadAlloc, QtCore is always built with exceptions on). The QCborValue unit test needed a temporary work around until we apply the same allocation fix (see next commit). Fixes: QTBUG-88253 Change-Id: I7b9b97ae9b32412abdc6fffd164523eeae49cdfe Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 9a55f40937d037d06e00b09465d8dad0554692fc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Make the signal argument in Q_OBJECT_BINDABLE_PROPERTY optionalLars Knoll2020-12-071-6/+2
| | | | | | | | | | | | The intention was always that you can define properties that do not require a changed signal. But having to explicitly pass a nullptr as signal parameter into the macro is ugly, so use the cool QT_OVERLOADED_MACRO to make it optional. Change-Id: I0ce366d043850f983c968d73c544d89933c48df9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit cb39ea05810bc207100018589da658a0cce98edb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QBindable: Disallow mutation if read-onlyFabian Kosmale2020-12-041-0/+5
| | | | | | | | | | | | | If a QBindable is created from a computed property, it is not possible to actually set a value or a binding. If we try to do it anyway, we'd get a crash. Thus we now check whether the function pointer is null before invoking it. Task-number: QTBUG-87153 Change-Id: I5bedb9080ccf79d9b8166b80d5733d095ed76f8d Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit e236faa75f446aa3378fb013cce6598c9e076ccb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* tst_qstorageinfo: Test the copy ctorMårten Nordheim2020-12-041-0/+7
| | | | | | | | | | It was previously untested Task-number: QTBUG-88183 Change-Id: Icc59fc632957a75cac8c7f5e2a1aed88a1c9ff9d Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit a7610a0cf79c576b098999822c5070a078e51326) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Replace discouraged Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPEAndreas Buhr2020-12-0410-12/+12
| | | | | | | | | | | | | | | Q_MOVABLE_TYPE was conceived before C++ had move semantics. Now, with move semantics, its name is misleading. Q_RELOCATABLE_TYPE was introduced as a synonym to Q_MOVABLE_TYPE. Usage of Q_MOVABLE_TYPE is discouraged now. This patch replaces all usages of Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPE in QtBase. As the two are synonymous, this patch should have no impact on users. Change-Id: Ie653984363198c1aeb1f70f8e0fa189aae38eb5c Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit 0440614af0bb08e373d8e3e40f90b6412c043d14) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add test for QTranslator::load() translation file lookup algorithmKarsten Heimrich2020-12-031-0/+69
| | | | | | | Change-Id: I70f4b3d7dbc46d21065eab21a5af8a38d4a60589 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> (cherry picked from commit a0e04e7d2bfc47891a85378a57ceb5dca1d4c558) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QProperty: Avoid spurious dependencies by suspending binding stateFabian Kosmale2020-12-021-1/+0
| | | | | | | | | | | Avoid spurious bindings by resetting the binding state before calling the setter of eager properties. Fixes: QTBUG-88999 Change-Id: I1e3b5662307d906598335a21d306be9c606529d4 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit b21dba98e3e557eece0497aeea0f0beb70cc62da) Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QDuplicateTracker: add testsMårten Nordheim2020-12-016-0/+211
| | | | | | | | | | | It didn't initially have tests. To avoid relying on realizing breakage implicitly through other classes we'll just add tests instead. Task-number: QTBUG-88183 Change-Id: I7449dc1f9a118d4b7a8158a2c34563dbd9c43c66 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> (cherry picked from commit 1911a4d40ab63d5e314d13d083d505cd3c64f683) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QProperty: add test case for spurious dependency issueFabian Kosmale2020-12-011-0/+52
| | | | | | | | Task-number: QTBUG-88999 Change-Id: Ifcbf23fedfb795771550762dfed8fc38bce65794 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit cea8b5832c56e92aba2b028afc965ddcf384d37b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Android: exclude faulty qfilesystemwatcher testAssam Boudjelthia2020-11-263-2/+7
| | | | | | | | Task-number: QTBUG-88508 Change-Id: I11b845e74e599d3bdae4f9490a591893531bc77b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit c7dec2faca476c94a40bd4ac5118915b1a5d9aa8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QVariant/QMetaType::compare APIsGiuseppe D'Angelo2020-11-256-3/+160
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | std::optional<int> is the wrong datatype to use for compare. First and foremost, it can't be used in the idiomatic form of auto r = a.compare(b); if (r < 0) ~~~ // a is less than b if (r > 0) ~~~ // a is greater than b which we *already* feature in Qt (QString, QByteArray). Also, std::optional<int> (explicitly) converts to bool, which is a trap, because the result of the comparison can be accidentally tested as a bool: if (a.compare(b)) ~~~ // oops! does NOT mean a<b Not to mention extending this to algorithms: auto lessThan = [](QVariant a, QVariant b) { return a.compare(b); }; // oops! std::ranges::sort(vectorOfVariants, lessThan); which thankfully doesn't compile as is -- std::optional has an *explicit* operator bool, and the Compare concept requires an implicit conversion. However, the error the user is going to face will be "cannot convert to bool because the operator is explicit", which is deceiving because the fix is NOT supposed to be: auto lessThan = [](QVariant a, QVariant b) { return (bool)a.compare(b); }; // big oops! Instead: backport to Qt the required subset of C++20's <compare> API, and use that. This commits just adds the necessary parts for compare() (i.e. partial ordering), the rest of <compare> (classes, functions, conversions) can be added to 6.1. Change-Id: I2b5522da47854da39f79993e1207fad033786f00 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 3e59c97c3453926fc66479d9ceca03901df55f90) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QVLA: do not include QtTestGiuseppe D'Angelo2020-11-251-1/+1
| | | | | | | | | The right include is QTest, QtTest drags in all of QtCore. Change-Id: Icc2964ccdb85fe1bfc9fe8f43351a4605a34329b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit bfe77a21fb0988a52fb77af09fe9675eb151e8b6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix tst_qlibrary after rebuildAndreas Buhr2020-11-242-2/+30
| | | | | | | | | | | | | | | | | tst_qlibrary depends on a library (targets mylib and mylib2) to be built. They create a library with the same name, in two versions. This is done in order to test versioned library loading. However, those two libraries were fighting over the creation of "libmylib.so". In a fresh build, mylib2 wins, as intended. But after a rebuild, mylib won, which led to failing unit tests. This patch changes the situation. With this change, mylib no longer tries to create "libmylib.so". Thus no fighting and no problem. Change-Id: Id89baa5503c9f078a8737ff0b8616edf09044f72 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 1dff26dd9539feb40767b7761c5339085ad74dbf) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix tst_qlibrary by telling CMake about required librariesAndreas Buhr2020-11-241-0/+1
| | | | | | | | | | | | | | tst_qlibraries needs to test libraries to be built in order to run successfully. However, these libraries were not mentioned as dependencies in CMake. This patch fixes that. Fixes: QTBUG-88445 Change-Id: Ic335e46664edd98217bd55a9bca5a58a39cffe66 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit f9d172f5a191a4e0e13923a6a1d31e86107bc75e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QMetaType: Track whether type is QML list typeFabian Kosmale2020-11-231-19/+23
| | | | | | | | | | This information is required in the QML engine to handle list properties (instances of QQmlListproperty<T> and list<T> types from QML). Change-Id: I1e30572f1c91f58b290cb9b4b07433af99a1db6f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 5806ecf5cb24cf39ea2608d42246eafbaa817582) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add unit test for QAnyStringView::compareAndreas Buhr2020-11-211-1/+8
| | | | | | | | | | | | Coverage tests revealed that QAnyStringView::compare(QAnyStringView, QAnyStringView, CaseSensitivity) was not tested in our unit tests. This patch adds a test for this. Change-Id: Id8e0d8af87e7e7ab192fb7554a278ddbb890fb14 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit ae2c30942086bd0387c6d5297c0cb85b505f29a0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Android: exclude qarraydata::dataPointerAllocate() from CI testsAssam Boudjelthia2020-11-201-0/+3
| | | | | | | | | Task-number: QTBUG-88705 Task-number: QTBUG-87025 Change-Id: If2dc0e650e5104d00a097e6195dd117d6cfd64e6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 4713298b98503cc7c4699a6e33e3167622da91d0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Test conversion of ulonglong variant to JSONSona Kurazyan2020-11-201-0/+12
| | | | | | | | | | Make sure ulonglong variant converts to a double JSON value when the value is greater than 2^63. Change-Id: I4d4392b05de29c220624056d5d0d4664fb2c08b7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 289f909621a8d83320d33e3ff7d651c164034098) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add unit test for QString::insert(negativeint, QChar)Andreas Buhr2020-11-201-0/+1
| | | | | | | | | | | QString::insert(qsizetype, QChar) can insert at negative positions, then counting from the end of the string. Coverage analysis revealed we do not have a unit test for this. This patch adds a unit test. Change-Id: I8d41b38df964c07fe2d2e7be444f8236c9e19b5d Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> (cherry picked from commit 7b0fd207756d367db768c3cb546fa439c15bbac8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add unit test for YearMonthDateAndreas Buhr2020-11-201-0/+31
| | | | | | | | | | Coverage analysis showed that QCalendar::YearMonthDate was not rigorously tested. This patch adds a unit test. Change-Id: I0af485d13c4883764b61ea1e35455905cc77b966 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> (cherry picked from commit b02147788b4013a698955aeea9fa92bb5613cc4d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add unit test for QString::replace with out-of-bounds positionAndreas Buhr2020-11-191-0/+10
| | | | | | | | | | | QString::replace(pos, len, *unicode, size) can handle positions which are outside of the this-string. In that case, it is a no-op. Coverage analysis revealed we do not have a unit test for this. This patch adds one. Change-Id: Id4a407e860fff0d5c7c0a200c379e5e3961c86d2 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Fix logic error in QString::replace(ch, after, cs)Andreas Buhr2020-11-191-0/+11
| | | | | | | | | | Coverage analysis showed that an if-branch marked "Q_LIKELY" was never taken. It turns out the code was incorrect, but behaved correctly. This patch fixes the logic and adds a unit test. Pick-to: 5.15 Change-Id: I9b4ba76392b52f07b8e21188496e23f98dba95a9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make QMetaTypeInterface constexpr on WindowsLars Knoll2020-11-191-12/+23
| | | | | | | | | | | | | | | | This was so far problematic as it gave various link errors. The solution to that seems to be to make the default constructor of QPairVariantInterfaceImpl constexpr to get around one set of problems. The other problem to solve where undefined references to metaobjects. The reason for that is apparently that QMetaTypeInterface contains a direct pointer to the meta object, something the linker doesn't like. Adding a level of indirection by using a function that returns the pointer seems to solve that problem. Fixes: QTBUG-88468 Change-Id: I5612ae807ea3b7e49bc40349d8d1fca1be9bd7ee Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Change QString formatting of negative numbers in non-base-10Andreas Buhr2020-11-191-0/+64
| | | | | | | | | | | | | | | | | | | For bases other than 10, negative numbers have been converted to QString by casting them to an unsigned number and converting that. Thus QString::number(-17, 16) returned "0xffffffffffffffef", for example. This patch changes the behavior so that negative numbers are converted like positive numbers. Additinally, this patch adds unit tests for QString::number. [ChangeLog][Important Behavior Changes] Changed QString::number(integer, base) for negative numbers and bases other than 10 to return the string corresponding to the absolute value, prefixed by "-". Fixes: QTBUG-53706 Change-Id: I0ad3ca3f035d553860b262f5bec17dc81714d8ac Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix QSFPM not emitting dataChanged when source model is setWang ChunLin2020-11-182-0/+30
| | | | | | | | | | | | | | QSortFilterProxyModel did not emit dataChanged when calling setSourceModel() after modifying the source model. QSortFilterProxyModel::setSourceModel and QSortFilterProxyModelPrivate::_q_sourceReset(), _q_clearMapping is called to delete the source_index_mapping. They also need to call create_mapping function to re-create it. Fixes: QTBUG-87781 Pick-to: 5.15 Change-Id: Idbe34696c9d3a2fbf354b653c870bac61378811d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Get rid of Q_COMPILER_CONSTEXPR checksAllan Sandfeld Jensen2020-11-175-28/+0
| | | | | | | Is required now. Change-Id: I62e95929d1649ea1390392230b619bd56d2a0349 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Test QTimer's isSingleShot() and timerType()Edward Welbourne2020-11-171-1/+7
| | | | | | | | | | Previously neglected in testing. Task-number: QTBUG-88183 Change-Id: Iacfca6f8c590af6dccb126cf3e43387ed50dbf06 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add some tests for various qmath.h functionsEdward Welbourne2020-11-171-0/+68
| | | | | | | | | | Previously untested. Task-number: QTBUG-88183 Change-Id: I9e94308471651e447f35a21329e43a363fb23961 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Improve qFloatDistance() test coverageEdward Welbourne2020-11-171-0/+1
| | | | | | | | | | | | Four code-paths that weren't tested are simply those with the parameters swapped from code-paths we did test. In any case, the float-distance between values should be symmetric, so test that. Task-number: QTBUG-88183 Change-Id: I2060eb77b1abada5b0fd5f4557dbb1761c5cfd02 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Track progress range in QFutureInterface::setProgressValueIvan Solovev2020-11-172-1/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously QFutureInterface::setProgressValue was silently ignoring the progress range and allowed to set any progress value. Also no checks were performed in QFutureInterface::setProgressRange, which allowed the user to set minimum > maximum. Add checking of the current progress range, when settings the progress value. Add checks for minimum and maximum values while setting the progress range. The implementation of the checks is mostly based on the logic that is used in QProgressBar. - If maximum is smaller than minimum, minimum becomes the only legal value. - If the current progress value falls outside the new range, the progress value is set to be minimum. - If both progressMinimum() and progressMaximum() return 0, the current progress range is considered to be unused, and any progress value can be set. - When setting the value using setProgressValue(), if the value falls out of the progress range, the method has no effect. Task-number: QTBUG-84729 Change-Id: I29cf4f94b8e98e1af30dd46fbdba39c421cf66bf Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Extend tests for QLoggingIvan Solovev2020-11-174-0/+384
| | | | | | | | | | Add tests for QMessageLogger class to explicitly cover all overloads of logging methods. Task-number: QTBUG-88183 Change-Id: I8d551f4b066cc285101646230bd9a17869ada3c1 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Move the iterator from QTypedArrayData to QListLars Knoll2020-11-171-2/+2
| | | | | | | | | | The low level implementation does not use it at all, so there's no point having the iterator in QTypedArrayData. Having it in QList removes and indirection and will lead to clearer error messages. Change-Id: I4af270c3cdb39620e5e52e835eb8fe1aa659e038 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>