summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Regenerate projects using pro2cmake one last timeAlexandru Croitor2020-12-1031-59/+189
| | | | | | | | | | 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>
* Fix tst_qlineedit for offscreen rendering and tiling window managersAndreas Buhr2020-12-091-3/+8
| | | | | | | | | | | | | | | | | | | tst_QLineEdit::QTBUG13520_textNotVisible checks that text is visible if a QLineEdit is set to Qt::AlignRight. To do that, it writes some text into a line edit and checks afterwards that the first character is in the left half of the window. This fails if the window is larger than twice the length of the text used and thus might fail in multiple situations where Qt is not in full control over the size of the windows created, as is the case with tiling window managers. This patch changes the test to not check for the first character in the left half of the window, but instead check for the first character be approximately at the expected position. Change-Id: I18f6de356ea20f4744f3a58cd2b1d76f6a9545a4 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> (cherry picked from commit aeb5165cb639ab682bbb6c5f778d53c9746c01ae) 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>
* Fix qtdiag testing helper on WindowsFriedemann Kleint2020-12-071-1/+1
| | | | | | | | | | The windows library user32 is no longer a known library for qmake; add it explicitly. Change-Id: I61f44e8a2cbccbabbdc5d58bd2615b431097aafd Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 5634bdf9ce1f3b30637f59f398e6134f75616c5f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* tst_QTcpSocket: stabilize connectToHostErrorTimur Pocheptsov2020-12-072-9/+27
| | | | | | | | | | | | | | | | | It's not _wrong_ to time out when connecting to something unreachable (it's just a different way of handling it) so we shouldn't fail when this happens either. In local testing (windows) it times out after 8 seconds, so bump the timer to 10 seconds. On systems where it's faster there'll be no difference as long as things don't go wrong. Fixes: QTBUG-88042 Fixes: QTBUG-89089 Change-Id: I8437cf8e4fbecedea2391ed87fdce1213085b964 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 27f52942b422b47a1283d918e0a0bc8761382921) (cherry picked from commit 4111d8e8e789c815ae37eb9903b042124e169078)
* tests: add a shortcut to quit app in allcursorsLiang Qi2020-12-041-0/+3
| | | | | | | Change-Id: I6b377cacfe05fc13c9f70e37247ed4da72f3f72e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit c48cb3381027779a5d58b02878893d176a83479a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QImage::setPixelColor on RGBA64_PremultipliedAllan Sandfeld Jensen2020-12-041-0/+8
| | | | | | | | | QColors were not premultiplied before being set. Change-Id: Id3765b6932a72374ddfd788fae4bb628a4edf0b7 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 0c19e3f703a7c3fd59e6db8a9d4ac7091674b552) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix uic/rcc generating outdated export for Qt for PythonFriedemann Kleint2020-12-044-8/+8
| | | | | | | | | | Bump version to 6. Fixes: QTBUG-89124 Change-Id: Ifcf60552b5b6efb86f79da34da9c34b8efae9fa4 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit fc9cda5f08ac848e88f63dd4a07c08b2fbc6bf17) 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_qmakelib: link to QtCore's private APIGiuseppe D'Angelo2020-12-041-0/+2
| | | | | | | | | Just like it was done in the .pro file. Change-Id: I7def52127f4bab6f0ef490ac7eee2de2da479352 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 9afb3506b344d5139284e49235d64215b48cee31) 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-0413-19/+19
| | | | | | | | | | | | | | | 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>
* Fix hashing of QPersistentModelIndexLars Knoll2020-12-031-0/+34
| | | | | | | | | | | | | The hash and equality operators used need to be consistent with each other. Unfortunately, QPMI::operator==() is not suitable to do this. So specialize qHashEquals() for QPMI. Fixes: QTBUG-88966 Change-Id: If5f19a722ae9fc4e78e93537e7ea15726f148768 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 83e95956ed58e88b11e2cc3cb61c5beacb7985db) 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>
* Fix tst_QFontDatabase::aliases failure with ambiguous fontEskil Abrahamsen Blomfeldt2020-12-021-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | If the first font in the families list happens to have been disambiguated because of duplicates, two things went wrong: 1. hasFamily() would return false for the font family, because it does not disambiguate when checking for the family name and only checks if the families list contains the exact string. 2. Adding aliases to the full disambiguated string is not supported, only the family name. The first issue has been reported separately as QTBUG-89068. The test failure is fixed by just avoiding the fonts that are ambiguous in the test, as it really doesn't matter which font we pick. Fixes: QTBUG-89008 Change-Id: I829778c2e7bb6090475c34dcf9cdce58862729d6 Reviewed-by: Liang Qi <liang.qi@qt.io> (cherry picked from commit 34fa01be82065241cd9a369ae49749422d8e7831) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Http2: Remove errored-out requests from queueMårten Nordheim2020-12-021-12/+0
| | | | | | | | | | | | | | | | | | | The requests will remove themselves once they get deleted but since the deletion is done through a _queued_ invokeMethod to 'deleteLater' we will call QHttpNetworkConnection::_q_startNextRequest first which may end up starting a reconnect of the TCP socket which we had the error on. In this specific instance it manifested as a race condition where we either don't get a proxyAuthorizationRequired signal at all (it was emitted while we didn't have any valid replies), or we get the signal emitted too late and it gets emitted on whatever the next reply was. Task-number: QTBUG-88417 Change-Id: If3f8ececc5550f1868c90124559cb8e3029646d8 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 65bcac95a7a051d4343aaa3c5ff8b39494aa14e4) 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>
* QSslConfiguration - improve code coverageTimur Pocheptsov2020-12-012-4/+43
| | | | | | | | | | By adding auto-tests that were missing/not triggering the paths found by LCOV. Change-Id: I472f59e8e7292786c80d7c8dcebde53a2982e1ec Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 1157167a5c69e253fdeb6c8ad532c5d52e150769) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QPasswordDigestor - improve code coverageTimur Pocheptsov2020-12-011-0/+59
| | | | | | | | | | By extending (a bit) an auto-test to cover paths found by LCOV. All of them is just to trigger the code that checks input parameters. Change-Id: I62f9a9045038ff8d123fd1396f4bfd85e75c6d8f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 95cbce3e6e0d8a1e82260cfb5b78491a3906be86) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QHeaderView: fix spurious sortingGiuseppe D'Angelo2020-12-011-0/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QHeaderView sorting may be triggered when the user performs some mouse interactions that should really not result in sorting. Generally speaking, this happens when the user: * presses on a non-movable section (A) * moves on another section (B) * releases on that section resulting in B becoming sorted / flipping sorting. (Non-movable is required, otherwise dragging would cause section moving, not sorting.) To make the matter worse, QHeaderView doesn't check that the release happens within its geometry. This makes sense when moving sections: one is able to drag a section horizontally/vertically even if the mouse leaves the QHeaderView. But when not moving sections, this means that one can * press on section (A), * move the mouse anywhere vertically (for a horizontal bar, mut.mut for a vertical) above or below another section (B), that is, outside QHeaderView's geometry * release the mouse and cause B to be sorted. Fix it by 1) remembering which one was the section that the user originally clicked on; that's the only one that can possibly become sorted (if we're not moving and other conditions hold). No other variable seemed to remember this. 2) on release, check that it happens within that section's geometry. If so, sort. Change-Id: Icfb67662221efbde019711f933781ee1e7d9ac43 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit b5b2640a65de20d05890fa9e6462bb7b88f83964) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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>
* tst_qtcpserver: Test pauseAccepting/resumeAcceptingMårten Nordheim2020-12-011-0/+33
| | | | | | | | | | | | | Currently untested The socks case is odd: after accepting the first connection it shows as unconnected. Details as for why is unknown, out of scope of adding this test. Change-Id: I0e7658f23b89f3af8db379b001ee33a844f3bec4 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 6035fd8f2c23357c46c401fb7120af83e5cf5887) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QDtls(cookie verifier): make sure a server can re-use 'Client Hello'Timur Pocheptsov2020-12-011-0/+14
| | | | | | | | | | | | | | | | And extend an auto-test for this. When a cookie verification mechanism is enabled, and verifier, indeed, verifies that some datagram is a 'Client Hello' message with a proper cookie attached, we start a real DTLS handshake creating a QDtls object and calling 'doHandshake'. In case cookie verification was enabled, we need parameters from the verifier (it's a crypto-strong 'number' and hash algorithm) to 'lock and load' the TLS state machine in a freshly created TLS session object. This code path previously was only tested manually and was found by LCOV as untested. Change-Id: Ieacb8c989997999ea10e15bda6ae106a0338b698 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 6a1d9f6fc1e46f7f0af7ec52dc5d6d415c918bf2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QSslSocket::verify: do not alter the default configurationTimur Pocheptsov2020-12-012-2/+96
| | | | | | | | | | | | | | | | | | | | QSslCertificate::verify() has an undocumented and not very desirable property - on some platorms it updates the default configuration, which can be surprising. For example, we deprecated QSslSocket::setDefaultCaCertificates() and recommend using QSslConfiguration::defaultConfiguration(), QSslConfiguration::setDefaultConfiguration(), and QSslConfiguration::setCaCertificates(). If an application does this to select CA roots it trusts explicitly, and then for some reason is calling verify, the application can have its QSslSockets successfully connecting to a host, whose root was not trusted by the application. Also, on Windows, defaultCaCertificates() include system roots already, no need to have them twice. [ChangeLog][QtCore][QtNetwork] QSslSocket::verify - do not change the default configuration Fixes: QTBUG-88639 Change-Id: I1cd40b259d0a6dcd15c78d1e7c027ff10859595c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 1158ff67b492853b72199ed78bfcf24132e1c7ff) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add widget-based test for TouchCancel eventKirill Burtsev2020-12-011-1/+83
| | | | | | | | | Follow up for 45a65cbeb2 Change-Id: Idb4f4eaaa3ee583462430c530f88a4cc32378d6c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 6c442ddbf584413fa4228aae4cc277887344e20d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* tst_QSslError: improve the code coverage, as pointed at by LCOVTimur Pocheptsov2020-12-013-38/+98
| | | | | | | | | | | | | And also, reduce the utter sloppiness, weirdness of the test and make it more a test and not a joke. Since the test itself depends on !QT_NO_SSL, why bother building and running its main, to create a useless tst_QSslError and do nothing then? Exclude test from no-ssl build. Change-Id: I67879b0de036cbc8c2f75a18f4cf94e6c43c5af0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit fe009bd51438877d864d2444f40582508c43c1f3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Bump the type info version in qhooks.cppLars Knoll2020-12-011-1/+1
| | | | | | | | | | | And correct the comment in tst_toolsupport. Amends change d99fdf17842d914daa41124184c6531c92766cd0. Change-Id: I94e296f5bb5b57132c887072efb0bb56aafc524f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 95730dd19cddd65588c902255513517556afc49f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Inline access to the QBindingStorageLars Knoll2020-11-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | And inline the fast checks inside the methods in QBindingStorage. This allows QObjectBindableProperty and friends to inline all the fast checks and almost completely eliminates the overhead for property accesses when no bindings are being used. Read and write times of QObject based properties when no bindings are being used: Read Write Old style property: 3.8ns 7.3ns QObjectBindableProperty (no notification): 4.5ns 4.3ns QObjectBindableProperty (with signal): 4.5ns 7.6ns QObjectBindableProperty (inline accessors): 3.2ns 3.4ns Numbers without this patch: Old style property: 3.8ns 7.9ns QObjectBindableProperty (no notification): 7.2ns 7.7ns QObjectBindableProperty (with signal): 7.2ns 16.0ns QObjectBindableProperty (inline accessors): 6.3ns 6.7ns Pick-to: dev 6.0.0 Change-Id: Ifd1fa3a489c3be8b1468c0b88af547aac397f412 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* 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>
* Android: exclude faulty tst_selftestsAssam Boudjelthia2020-11-263-2/+11
| | | | | | | | | | | | This test was failing but was returning a pass because of a bug in androidtestrunner. Task-number: QTBUG-88507 Task-number: QTBUG-88508 Change-Id: I4fda7c2ddf8cd1e6858617e7bb447078c5768a75 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 63934f13380c9ed3c455394e2ba863d44239f05c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Android: fix tst_android testAssam Boudjelthia2020-11-262-3/+2
| | | | | | | | Fixes: QTBUG-88506 Change-Id: I938de388fce8ec393b03b2f0f42ddfe9094e6a5e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 97b914b3e7410ee013ab50680210309524960f55) 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>
* CMake: Change generated resources namingAlexey Edelev2020-11-241-3/+3
| | | | | | | | | | | Align generated resources .qrc file naming to qmake naming. Update tests. Fixes: QTBUG-88581 Change-Id: Id8a2f91f23c257e5b8bd371748c2151ec54a6418 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 2548438e326d20eda2eb4398139164f5400d22ac) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix tst_qfiledialog2 in case directory ~/foo existsAndreas Buhr2020-11-241-2/+2
| | | | | | | | | | | | One test in tst_qfiledialog2 only succeeded if the directory "~/foo" did not exist. This patch changes the path used to "~/Vugiu1co" which has hopefully a much lower probability of existing. The string "Vugiu1co" is taken from a call to "pwgen". Change-Id: Ia82b07902a91eb908a74aa90cdbdf4761d432d9a Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io> (cherry picked from commit 824de3850e50904720f959d823fc8d962b639522) 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>
* Blacklist authenticationCacheAfterCancel on Ubuntu 20.04Alexandru Croitor2020-11-241-0/+4
| | | | | | | | | | | | | | It flaky fails integrations. Amends 2b49b01aa3467173f0be9252cfa50b41a311dd57 Task-number: QTBUG-88417 Change-Id: I6aad6ee7a70e580da64e75f69e8c9cab1cb78cd7 Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 143d619ba33c693fbbf9fbc3587921a44ae87435) 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>
* Fix compiler warning about discarded return valueVolker Hilsheimer2020-11-231-1/+1
| | | | | | | | | | Not testing the result of the copying, just verifying that it doesn't assert. Change-Id: Ib51129134b74c17eada7e3819ccfff10bb9affbf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit e59ab8b5907f87a77cc6924abab5fb1c82483856) 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>
* Fit tst_qprinterinfo in case there are printers in local networkAndreas Buhr2020-11-211-4/+2
| | | | | | | | | | | | | tst_qprinterinfo compared the output of "lpstat -p" with the result of a call to "cupsGetDests". "lpstat -p" only returns local printers, "cupsGetDests" also returns printers on the local network. This patch fixes the test by using "lpstat -e", which also shows printers on the local network. Change-Id: Ia70adad8b8467f4c738f769d34757786fc9645b2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 146a2a21b1fd279e3f26690243db30fba89f9027) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>