summaryrefslogtreecommitdiffstats
path: root/tests/auto
Commit message (Collapse)AuthorAgeFilesLines
...
* tests: blacklist tst_QGlyphRun::drawRightToLeft() on openSUSELiang Qi2020-12-081-0/+2
| | | | | | Task-number: QTBUG-89169 Change-Id: I4dfd608e264c9503093cc9fe27e80c489efe7aaf Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
* QCborValue & QCborStreamReader tests: fix warning about %llx on 32-bitThiago Macieira2020-12-071-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. Pick-to: 5.15 6.0 Change-Id: I00b01c01a66748508ea1fffd164a9add2a2650cf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* tst_QCborValue: adjust the size of the minimum string that won't fitThiago Macieira2020-12-071-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. Pick-to: 5.15 6.0 Change-Id: I55083c2909f64a1f8868fffd164e7e8c24eec1f8 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QCborStreamReader::next: don't allocate too much memory in a QBAThiago Macieira2020-12-072-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. Pick-to: 5.15 6.0 Change-Id: I7b9b97ae9b32412abdc6fffd1645458c655cc566 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add SameSite API to QNetworkCookieAllan Sandfeld Jensen2020-12-071-0/+13
| | | | | Change-Id: I3f8b25418154f74bb55fa978b03465f75771d015 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tst_qnetworkreply: unblacklist putWithServerClosingConnectionImmediatelyMårten Nordheim2020-12-072-4/+3
| | | | | | | | | | | | Looking at grafana it rarely fails in dev so unblacklisting it. Though it is a little more flaky after switching to http 2 by default because then we only have one channel and more requests end up queued in the same channel, which will get errored out when the server disconnects. Task-number: QTBUG-88943 Change-Id: If5d6335864ce6bbc35f519b2c6d7068e4181afd2 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* tst_qnetworkreply: unblacklist various testsMårten Nordheim2020-12-071-18/+0
| | | | | | | | | | | | | | | | | | | headFromHttp hasn't been flaky since 5.14 times according to grafana, does not fail locally. Same situation with ioHttpRedirect as above. ioHttpRedirectMultipartPost has not failed on Windows since october 2019, assumed stable now. backgroundRequestInterruption no longer exists. ioPostToHttpFromSocket would fail in debug MSVC builds but was fixed in 710886fbdd993c3a618ea8bc8b59fbb3e18cfbf0. Task-number: QTBUG-88943 Change-Id: Ida640179ef15a3452291745e4e94a71a385f57ae Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* 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. Pick-to: 6.0 Change-Id: I0ce366d043850f983c968d73c544d89933c48df9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* uic/rcc: Use QT_VERSION_MAJOR for major versionFriedemann Kleint2020-12-071-2/+4
| | | | | | | | Amends 539a16a69fa1ef302cf4eb97ff5a7f8afb606d15. Task-number: QTBUG-89124 Change-Id: I68c9ab2179d464d83c3fd9eefc5609b7a5a58e27 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* QCborValue: avoid allocating result if data is insufficientThiago Macieira2020-12-062-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. Pick-to: 5.15 6.0 Fixes: QTBUG-88256 Change-Id: I7b9b97ae9b32412abdc6fffd16454b7568a063ba Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QCborStreamReader: avoid allocating result if data is insufficientThiago Macieira2020-12-063-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). Pick-to: 5.15 6.0 Fixes: QTBUG-88253 Change-Id: I7b9b97ae9b32412abdc6fffd164523eeae49cdfe Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* 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>
* QtConcurrent: filter/map reduction without default ctorIvan Solovev2020-12-042-0/+78
| | | | | | | | | | | | | | | | | Previously a default constructor was required for the result type of mappedReduced() and filteredReduced(), even if a default value was provided. This patch fixes the problem. The issue was in the ResultReporter type, that was calling QList::resize() to adjust the size of expected reported results. A default-value parameter was added to the class, so that a corresponding overload of QList::resize could be invoked. Task-number: QTBUG-88452 Change-Id: I51113753e314d76aa74d201b5a7e327a6ca75f47 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Fix QImage::setPixelColor on RGBA64_PremultipliedAllan Sandfeld Jensen2020-12-041-0/+8
| | | | | | | | QColors were not premultiplied before being set. Pick-to: 6.0 5.15 5.12 Change-Id: Id3765b6932a72374ddfd788fae4bb628a4edf0b7 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* tst_qmakelib: link to QtCore's private APIGiuseppe D'Angelo2020-12-041-0/+2
| | | | | | | | Just like it was done in the .pro file. Pick-to: 6.0 Change-Id: I7def52127f4bab6f0ef490ac7eee2de2da479352 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* 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. Pick-to: 6.0 Task-number: QTBUG-87153 Change-Id: I5bedb9080ccf79d9b8166b80d5733d095ed76f8d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix hashing of QPersistentModelIndexLars Knoll2020-12-041-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>
* Fix compiler warning from discarded return valueVolker Hilsheimer2020-12-041-1/+1
| | | | | | | | Amend 53b7cb1bd73c773521f85c48ecd0c9daed14f7b3, match() is only used to provoke data races. Change-Id: Id20b11fedf7f20e74baab15bbb60c995c1a0c794 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_qstorageinfo: Test the copy ctorMårten Nordheim2020-12-031-0/+7
| | | | | | | | | It was previously untested Task-number: QTBUG-88183 Pick-to: 6.0 Change-Id: Icc59fc632957a75cac8c7f5e2a1aed88a1c9ff9d Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* tst_qnetworkreply: stabilize and unblacklist getFromHttpIntoBuffer2Mårten Nordheim2020-12-042-8/+7
| | | | | | | | | | | | | | The test in general is fine, but it was making an assumption that the first 5 readyRead emissions would never result in the whole message being received. In certain scenarios with slowdown however it was still possible that we would receive the whole message after just a few readyReady emissions. While I didn't check it's most likely due to a mechanic in the QNetworkReply machinery where we suppress some emissions if we know there's more data just about to be available. Task-number: QTBUG-88943 Change-Id: I0cf06edb34d4e86cc8a42c0f1cd7e8c35765f6ee Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* tst_QTcpSocket: stabilize connectToHostErrorMårten Nordheim2020-12-041-2/+2
| | | | | | | | | | | | | | | 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. Pick-to: 6.0 Fixes: QTBUG-89089 Change-Id: I8437cf8e4fbecedea2391ed87fdce1213085b964 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Add test for QTranslator::load() translation file lookup algorithmKarsten Heimrich2020-12-031-0/+69
| | | | | | Pick-to: 5.15 6.0 Change-Id: I70f4b3d7dbc46d21065eab21a5af8a38d4a60589 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* tst_containerapisymmetry: fix typoGiuseppe D'Angelo2020-12-031-1/+1
| | | | | Change-Id: I9fd5c982a72cd4483108293667b2ae60f7b82ce7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add test for qRoundDavid Skoland2020-12-021-0/+56
| | | | | | | | | Add test for qRound that covers some edge cases for rounding. Note that as of right now, this test fails and the docs have been updated to warn that it should not be depended on for strict correctness. Change-Id: I1a61bca47abd77855fe7c13ded44e913cc7e8722 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* tst_qnetworkreply: cleanup BLACKLISTTimur Pocheptsov2020-12-022-19/+27
| | | | | | | | | | | | Which contains a lot of 'macos'/'osx' black-listed auto-tests. They mostly fail with SecureTransport (on BigSur) because SecTrustEvaluate() does not like our old certificate. Instead, since SecureTransport is deprecated anyway and we are not planning to develop it in future, skip the related auto-test depending on QT_CONFIG(securetransport). Task-number: QTBUG-88943 Change-Id: I5f6cb7b2d0ea15c445603c1ff3e1700f123c28d1 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Unblacklist tst_qnetworkreply getFromHttpMårten Nordheim2020-12-021-3/+0
| | | | | | | | | It was blacklisted due to the issue there. The issue is resolved, but the blacklist stayed. Task-number: QTBUG-88943 Change-Id: I7d9a660a17c1463dd8b654752ed5787fe5f5af24 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* 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 Pick-to: 5.15 6.0 Change-Id: I829778c2e7bb6090475c34dcf9cdce58862729d6 Reviewed-by: Liang Qi <liang.qi@qt.io>
* Associative containers: add erase_ifGiuseppe D'Angelo2020-12-021-0/+67
| | | | | | | | | | | | | | | | | | | | Use a trick similar to the one we use for their ranged constructors: support predicates that either take a container's iterator, or that take a std::pair (for STL compatibility). [ChangeLog][QtCore][QMap] Added removeIf() and erase_if(). [ChangeLog][QtCore][QMultiMap] Added removeIf() and erase_if(). [ChangeLog][QtCore][QHash] Added removeIf() and erase_if(). [ChangeLog][QtCore][QMultiHash] Added removeIf() and erase_if(). Change-Id: Ie40aadf6217d7a4126a626c390d530812ebcf020 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* 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 Pick-to: 5.15 6.0 Change-Id: If3f8ececc5550f1868c90124559cb8e3029646d8 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QSet: add insert(T&&)Mårten Nordheim2020-12-022-5/+79
| | | | | | | | | | | | | | We already have all we need in QHash to support this, so the addition is simple enough. Add test checking how many copies and/or moves are needed for a single insert. As a drive-by: remove some unneeded static_cast Change-Id: Iaf768657644afa45f78f5c81ffcf89ba9607be96 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add tests for the new erase/erase_if for sequential containersGiuseppe D'Angelo2020-12-012-0/+90
| | | | | | Change-Id: I3bac5f6f04f3028fbc21f1b4b15b00252a7accb1 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_containerapisymmetry: use an algorithmGiuseppe D'Angelo2020-12-011-3/+3
| | | | | | | | In preparation for the next changes. Change-Id: Ibe0635dfa040842073749aa3e2ae140f27dc983a Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add a way to check whether a metatype has datastream operatorsLars Knoll2020-12-011-0/+3
| | | | | | | | | Add QMetaType::hasRegisteredDataStreamOperators() to complement the method to check whether a data stream operator exists. Fixes: QTBUG-82916 Change-Id: Ib2f841131b7c401d5a3ae76d49104e41697c4eac Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* 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. Pick-to: 6.0 5.15 Change-Id: Icfb67662221efbde019711f933781ee1e7d9ac43 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QProperty: Avoid spurious dependencies by suspending binding stateFabian Kosmale2020-12-011-1/+0
| | | | | | | | | | Avoid spurious bindings by resetting the binding state before calling the setter of eager properties. Fixes: QTBUG-88999 Pick-to: 6.0 Change-Id: I1e3b5662307d906598335a21d306be9c606529d4 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QProperty: add test case for spurious dependency issueFabian Kosmale2020-12-011-0/+52
| | | | | | | Task-number: QTBUG-88999 Pick-to: 6.0 Change-Id: Ifcbf23fedfb795771550762dfed8fc38bce65794 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* 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. Pick-to: 6.0 Change-Id: I0e7658f23b89f3af8db379b001ee33a844f3bec4 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QNetworkDatagram: Test copy ctor and clear()Mårten Nordheim2020-12-011-0/+11
| | | | | | | As they were not currently tested Change-Id: I91bc8dead2c098376001a8502d29bfc746d33f73 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@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 Pick-to: 6.0 Change-Id: I7449dc1f9a118d4b7a8158a2c34563dbd9c43c66 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Disable some OpenGL and QRhi tests for offscreen backendAndreas Buhr2020-12-013-1/+11
| | | | | | | | | | This patch disables four failing unit tests when executed with the offscreen backend. Change-Id: Ie67341b886984e6de19cd8dd8a8a237a620a1b7a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Fix compiler warnings from mixing signed/unsigned intsVolker Hilsheimer2020-12-011-3/+3
| | | | | Change-Id: I146203dd8b6dddabc0a7cf4b3db8a3fd379fc0c6 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* 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. Pick-to: 5.15 Pick-to: 6.0 Change-Id: I67879b0de036cbc8c2f75a18f4cf94e6c43c5af0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Inline access to the QBindingStorageLars Knoll2020-11-301-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 Change-Id: Ifd1fa3a489c3be8b1468c0b88af547aac397f412 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 98c82fb445acf45cc4c4bc86a5adda43358127bf) Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QSslSocket::verify: do not alter the default configurationTimur Pocheptsov2020-11-302-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 Pick-to: 5.15 Pick-to: 6.0 Pick-to: 6.0.0 Fixes: QTBUG-88639 Change-Id: I1cd40b259d0a6dcd15c78d1e7c027ff10859595c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QDtls(cookie verifier): make sure a server can re-use 'Client Hello'Timur Pocheptsov2020-11-301-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. Pick-to: 5.15 Pick-to: 6.0 Change-Id: Ieacb8c989997999ea10e15bda6ae106a0338b698 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tst_QSslKey: remove blacklistTimur Pocheptsov2020-11-302-6/+6
| | | | | | | | | | | And do not run the test with QSslSocket::supportsSsl() returns false - this may mean unresolved symbols and thus missing functionality, like i2d_X509 etc. This also makes cases more like other, that already had those checks. Fixes: QTBUG-87386 Change-Id: If4e9a650ca325b6f70956f532891a4c1d50465c0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add widget-based test for TouchCancel eventKirill Burtsev2020-11-301-1/+83
| | | | | | | | Follow up for 45a65cbeb2 Pick-to: 6.0 Change-Id: Idb4f4eaaa3ee583462430c530f88a4cc32378d6c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* tst_QSslCertificate - improve code coverageTimur Pocheptsov2020-11-306-1/+216
| | | | | | | | | Some code-paths were never executed by auto-test, thus giving us LCOV's diagnostic. Extend existing tests and add new ones. Pick-to: 5.15 Change-Id: I648747547f0525a482216b1e1972fcc698c73f65 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QMetaObjectPrivate: Add firstMethodFabian Kosmale2020-11-301-0/+39
| | | | | | | | | | | QMetaObject::indexfOfMethod returns the method corresponding to a specific signature. In QML, we however only want any of the methods with a given name (and do overload resolution at a later point). For this usecase this patch introduces the internal QMetaObject::firstMethod function. Change-Id: Ie3820354edffb273c4cbe1399201a955ebe79344 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix QVariant/QMetaType::compare APIsGiuseppe D'Angelo2020-11-306-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>