summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/tqtc/lts-5.15.7' into ↵Tarja Sundqvist2022-09-1226-71/+751
|\ | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: I976ce0c3664c9953dd0019b7d76d3f603583634f
| * Http/2 - handle PADDED flag correctlyTimur Pocheptsov2021-10-121-0/+84
| | | | | | | | | | | | | | | | | | | | | | | | Previously, when deciding where the actual data is, Frame was calling padding() to test if offset is needed. A curious case with a DATA frame containing compressed body and having 'PADDED' flag set with a padding equal to ... 0, ended in a decompression error (and assert in 6.2 code). Fixes: QTBUG-97179 Change-Id: I9341a4d68510aa4c26f4972afdcd09a530d5a367 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit dd57605b9ef4e12805868962efce586e57e342b6)
| * Reduce the width of a hfw-widget if scrollbar would be flippingVolker Hilsheimer2021-10-111-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For a widget that implements height-for-width, the vertical scrollbar becoming visible might be just enough to make the scrollbar unnecessary. In that situation, the scrollbar flips on and off continuously. To avoid that situation, make the width of the widget smaller until the height fits without scrollbar, up to the point where we have space for the scrollbar anyway. The calcuation here is assumed to be cheap, but depends on the heightForWidth implementation in the widget. Running the while-loop a few dozen times should have no performance impact during resizing and laying out the scroll area contents. Add a test that confirms that within a brief period of time we only get the one hide-event we expect. Done-with: Zou Ya <zouya@uniontech.com> Fixes: QTBUG-92958 Change-Id: I0faeb5f9b1a226aada958c18333d9c2ac8203dd1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 6c4dc722cb9bf765904feefff4fb00bdb0b3dc9f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * QCocoaWindow: Make window key if the app's modal window is hiddenDoris Verria2021-10-081-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On macOS, when showing a window, we decide if it should be made key and therefore active, if the app has no active modal session or if the window's worksWhenModal returns true. However, the window needs to be made key also when a modal window is present, but not visible. Add this condition when checking if the window needs to be made key. This makes the behavior consistent with what happens when a modal is minimized on macOS. The input focus is passed to the next window, and the window appears active, even if it can not be interacted with. Fixes: QTBUG-85574 Change-Id: I204d4f912128f4a46840789fc2ee08e1b2716bfc Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 911c97f2b59945093e9e87130d687c6a2a9423ac) Reviewed-by: Doris Verria <doris.verria@qt.io>
| * QThread: Reset the system thread ID when thread exits on UnixIevgenii Meshcheriakov2021-10-051-0/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unix QThread implementation stores pthread_t as a system thread ID when the thread is created, but never resets the system ID when those threads are destroyed. Some implementations may reuse the same thread IDs for new threads, and this may cause QThread::wait() to erroneously complain that "Thread tried to wait on itself". This patch sets the system thread ID to nullptr when the thread is about to exit and be destroyed by the system. A regression test is added to tst_qthread. Fixes: QTBUG-96846 Change-Id: I0850425dd0e09af50e59c9038e7e662a2a624beb Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (adapted from commit 52ad59f9eabbe1fc8ca49d117e4955f2d21d50a7)
| * Add testing of QPdfWriter output to QPainter lancelot testEirik Aavitsland2021-09-282-1/+103
| | | | | | | | | | | | | | | | | | | | | | Utilizes the native pdf renderer of macOS, so the test is only enabled on that platform. As the PDF generation should be platform independent anyway, this should not matter. Change-Id: I8b6b70562d1f24fdb77795aa7eb5843279aaae85 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 5e2725772aa25e0ee95269c8f996fdb7bc4705e7) Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
| * Preserve QImage metadata when converting format with color tableEirik Aavitsland2021-09-281-0/+7
| | | | | | | | | | | | | | | | | | | | | | Unlike the other conversion functions, convertWithPalette() did not call copyMetadata(). Fixes: QTBUG-96926 Change-Id: I2b171cec16bc5a90d33e80d6fe178c650ed3fe36 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 66a44f4ebac0dc20422477afe794fa712dea01bc) Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
| * QTranslator: Fix loading of meta catalogs from absolute .qm pathKai Köhne2021-09-271-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case of QTranslator translator; translator.load("somedir/file.qm"); and file.qm being a meta catalog file, the sub-catalogs in somedir couldn't be located, unless "somedir" was set as second argument. Fixes: QTBUG-95013 Change-Id: I06103244ce2ff9800c2c64cb0c17f9bc7ef0e8de Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> (cherry picked from commit 85eaae36f6951f03c4aeac50ca826fea5cc088bd) Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
| * tst_qtranslator: Simplify extraction of test dataKai Köhne2021-09-273-39/+5
| | | | | | | | | | | | | | | | | | | | This makes it easier to further extend the test. The overhead this causes is negligible. Change-Id: I42941879f55337268bb2914e122a5f573ab7e6f9 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> (cherry picked from commit 841ce1f938219cb975099a28b720abeb95eea19d) Reviewed-by: Kai Koehne <kai.koehne@qt.io>
| * Fix querying font aliases that share name with other fontsEskil Abrahamsen Blomfeldt2021-09-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a332f3fabc29f796526202648eddf35a24f1cb67 disabled resolving all fonts on the system for every font lookup, which was a significant startup time improvement. But it also caused a regression: When a font has an alias which shares the name of a proper font, then this would not be resolved correctly. This is fairly typical on Windows/GDI due to backwards-compatibility. Instead of being collected under a shared typographical family, fonts are disambiguated by adding the style name to the family name. The proper typographical name is still available, but this is not enumerated by the system. So "Segoe UI" for instance, will be available as "Segoe UI", "Segoe UI Light", "Segoe UI Bold" etc. When we populate family aliases, we register that "Segoe UI Light" is actually "Segoe UI" with Light weight, and prior to a332f3fabc29f796526202648eddf35a24f1cb67 this would be done implicitly. But after the optimization, we would only populate family aliases once we stumbled over a font request for a non-existent font. For "Segoe UI", we would simply return the regular weight font as the best imperfect match. The fix is to populate font family aliases not only when the family is non-existent, but when the match is imperfect, e.g. if we are asking for a Light weight font and only finding a regular one. User code can still avoid this somewhat expensive operation by using the full family names on Windows. This also requires a fix to a test. When removeApplicationFont() is called, we invalidate the font database, so it will be reset to a state that does not contain the family aliases. Therefore we cannot guarantee that it is identical to what it was before the test started, since this depends on what has happened previously in the application. [ChangeLog][QtGui][Text] Fixed an issue where some font styles and weights would not be selectable. This was especially noticeable on Windows. Fixes: QTBUG-94835 Change-Id: I892855edd1c8e3d3734aace396f6000d897d2ec4 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit e0ad2cee55193696285cc84bf5c4922bb7247e9a) Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * QWidgetWindow: Stabilize test on XcbVolker Hilsheimer2021-09-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Showing, hiding, and showing a window can result in the Xcb QPA plugin warning about qt.qpa.xcb: internal error: void QXcbWindow::setNetWmStateOnUnmappedWindow() called on mapped window The point of the test is to verify that we get a paint event on a window that is shown again after having been hidden, not to verify that async windowing systems can handle a show/hide/show sequence. So wait for the window being exposed before we hide it. Change-Id: If91a9926613645e78e332dacff34bd57e4034b6f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 3714e51436eebb64873c58dc36cf89ef8f139f09) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * Blacklist flaky testDimitrios Apostolou2021-09-201-0/+4
| | | | | | | | | | | | | | Task-number: QTBUG-96270 Change-Id: I3feb604c0c2f394b2915b3d98d3b02f469331a18 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit a5d501000ea4eb9d282ed0a15e7c5fb1e1837712)
| * QThreadPool: Fix restarting of expired threadsIevgenii Meshcheriakov2021-09-181-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ensure that expired threads have actually finished before attempting to restart them. Calling start() on a thread that is not yet finished does nothing. Add a regression test into tst_qthreadpool that attempts to trigger reuse of expired threads and verifies that all submitted tasks execute. Fixes: QTBUG-72872 Change-Id: I2109b628b8a4e91491115dc56aebf3eb249646b5 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 1afd562b0b0bbba02575aa79601f0fae555cfa19) Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
| * Make test pass on machines with many coresLars Knoll2021-09-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Just starting 20 threads to test this won't cut it if the machine you're testing on has an ideal thread count of 16 or larger. Change-Id: Icba8f00aa836fec6da41c71b318e9e17bdd47c0e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit bbc19bd9795ad873d4ff7c8f793aaff554c6b3eb) Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| * Blacklist tst_QSocks5SocketEngine::simpleConnectToIMAP() because of flakinessDimitrios Apostolou2021-09-151-0/+3
| | | | | | | | | | | | Task-number: QTBUG-96345 Change-Id: I2c943d8aefd490896b9bca7a7438084c4cda06da Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| * Blacklist tst_qgl:closeAndThenShow() because of flakinessDimitrios Apostolou2021-09-151-0/+3
| | | | | | | | | | | | Task-number: QTBUG-96271 Change-Id: I11718aeb699f1d240ae740b758869b3ae92c905d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
| * tst_http2: Fix flaky authentication testMårten Nordheim2021-09-111-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | The h2 server is running in a separate thread, so while the previous test was finished and the server was deleted, it could still emit and have a queued emission in-flight which would be picked up by the next running test. Change-Id: I26b1bc711df7473032d6078f35f8aca37c40137e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit c942bae4ebf903a60a8bd3da9500f7733c71b04d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * Fix QTextCodec::canEncode() for ICU codecIvan Solovev2021-09-082-1/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QTextCodec::canEncode() relies on the number of invalid characters to determine if the encoding is possible or not. By default the ICU fromUnicode converter method does not provide any ways to track the amount of failures. However it uses callbacks to report errors or replace unrecognized characters with substitute string. This patch introduces a custom callback for fromUnicode conversion. The callback just increases the invalid characters counter and then calls the default callback, which does its usual job. Task-number: QTBUG-83081 Change-Id: Ie07fd183c728c7c77e8285f55238b1d57f5c9eb2 (adapted from commit 421de71a521ab07e942ae46a8f0a8f36147d86c8) Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| * qlocale_win: Fix non-standalone month namesEdward Welbourne2021-09-021-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have previously been using the standalong (nominative) month names both when asked for that and when asked for the plain (genitive) month name, probably because there was no LCTYPE value for the latter. However, MS's docs for the standalone values do contain a comment telling us how to get the genitive names. Rename the old monthName() to standaloneMonthName() and add a monthName() that calls GetDateFormat() suitably, as described by the MS doc. Fixes: QTBUG-92018 Fixes: QTBUG-86279 Change-Id: I27f63198c3a15b792683f476d2019078b0860f99 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 38ec2c830b849ad44ca7e16bd9c4722e0bcdb61f)
| * Improve lancelot test of dashed line paintingEirik Aavitsland2021-08-303-4/+70
| | | | | | | | | | | | | | | | | | | | | | | | Add painting of sets of lines, both connected and unconnected, that go outside the device area. This prepares for fixes & improvements in the painting code. Change-Id: I9cffc760524e9ade42362c9a04949270ac24180f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 587fe1a95ad2789c2f284fb1384f19b7f5b09917) Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
| * QGraphicsProxyWidget: forward Window(De)Activate eventsVolker Hilsheimer2021-08-271-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The nested widget might be a QGraphicsView as well (documented to be supported), and QGraphicsScene maintains it's own activation status by counting Window(De)Activate events. We need to make sure that the embedded widget is informed about its activation status so that deeper nested children can receive focus. Forward WindowActivate/Deactivate events to the nested widget, which will pass it on to all its children. Add test case, which without this fix fails when verifying the inner scene's isActive state, or later when testing that focusInEvent is delivered to the embedded widget. Fixes: QTBUG-94091 Change-Id: I4e0ecef50685ed081d15c7f76b6c1a4a40ed2682 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 01aeb5f7e4fd977e9698fffdc7650897664ecb82) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * Unicode: fix the grapheme clustering algorithmGiuseppe D'Angelo2021-08-241-0/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An oversight in the code kept the algorithm in the GB11 state, even if the codepoint that is being processed wouldn't allow for that (for instance a sequence of ExtPic, Ext and Any). Refactor the code of GB11/GB12/GB13 to deal with code points that break the sequences (falling back to "normal" handling). Add some manual tests; interestingly enough, the failing cases are not covered by Unicode's tests, as we now pass the entire test suite. Amends a794c5e287381bd056008b20ae55f9b1e0acf138. Fixes: QTBUG-94951 Change-Id: If987d5ccf7c6b13de36d049b1b3d88a3c4b6dd00 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit d48058f1970a795afb4cedaae54dde7ca69cb252) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * Fix bug with NoFontMerging when font does not support scriptEskil Abrahamsen Blomfeldt2021-08-241-3/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using NoFontMerging, no fallbacks should be resolved. If the font does not support a specific character in the text, we should display a box instead of merging it with another font. But in practice, Qt would still apply the fallback mechanism for one specific case: If the font itself does not support the script of the text, we would get no match and do a search for a fallback instead. Since NoFontMerging is set, we would then force this as preresolved for *all* scripts in the QFont's private data (logically, the match should only have a single response for NoFontMerging). The end result was that if you set the font family before updating the text, you would get broken rendering. This can happen e.g. in Qt Quick, where you could update the font family of a text label while it contains characters which are not supported by the new font. Qt would then pick a fallback instead. When you subsequently update the text, the fallback would already be preresolved for whatever script this is. If it does not support the updated text, we would then see boxes, even if the requested font actually would have supported it. The fix is simply to do an additional pass if NoFontMerging is set and we were not able to match with the specified script. Since the same family might be available in different foundries, with different writing system support, we still want to do a pass first to see if we can match the exact script of the text. Note that QRawFont::fromFont() exploited the bug by using NoFontMerging for getting the fallback font for a specific writing system. To keep this working without having to rewrite fromFont() and risk introducing regressions, we add an argument to make the findFont() function behave as before. It isn't super-pretty, but since it is private API it is hopefully fine. [ChangeLog][QtGui][Text] Fixed an issue with NoFontMerging and changing font families dynamically, where boxes would be seen in place of the correct text. Done-with: Andy Shaw Fixes: QTBUG-81770 Change-Id: Ide9a36d7528a1040172c5864fa99e7a82eac4e83 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 43a63901f4eb61ad8a29f4cc7a1700685f88ec35)
| * Attempt to unwedge tst_QThread::wait3_slowDestructor()Edward Welbourne2021-08-231-13/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the test failed, it never released the blocking slot, so the tested thread remained blocked indefinitely. Blacklisting doesn't rescue that: the test run gets killed by Coin's watchdog. Use a QScopeGuard() to release the clocked slot on failure. replacing the release that was happening only on success. As drive-by clean-up, smarten up the code a little and remove an unused enum. Change-Id: Ie035dafe6e4b1d82aea5de38ceb31c0f7fcf81d7 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> (cherry picked from commit 2684deaf26e7c7af1ac504f562231a4cc4fbd733)
| * Use a scope-guard to take care of process deletion in a testEdward Welbourne2021-08-191-6/+5
| | | | | | | | | | | | | | | | | | | | Doing the deletion at the end of the block only works if the test passes. Drive-by: remove spurious braces from single-line bodies of single-line controls. The QTest macros are done properly. Change-Id: I83002547dba49ab9792f4db44d73151b1c036900 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> (cherry picked from commit 4ccbd751f1eee5c27ce5d4c9868d65092630d991)
* | Network: Update expired certv5.15.6-lts-lgplMårten Nordheim2022-08-182-30/+30
|/ | | | | | | Change-Id: I233ffee5b720c0554071c1d49d4fb861736b2e2a Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 6cbe8f74ce5940f749796c88db2322b1a0d3dd8b) Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Revert "QString::lastIndexOf: fix off-by-one for zero length matches"Tarja Sundqvist2021-08-181-1/+1
| | | | | | | | | | This reverts commit 3a273ac47f20e82a1f2f63411b210025ca0f4495. The revert is needed as QString::lastIndexOf was broken after the original patch. Task-number: QTBUG-94215 Change-Id: Ic1c81daa7b5ce8861911210ff34049ed7704ed4a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Refix for avoiding huge number of tiny dashesEirik Aavitsland2021-08-101-0/+31
| | | | | | | | | | | | Previous fix hit too widely so some valid horizontal and vertical lines were affected; the root problem being that such lines have an empty control point rect (width or height is 0). Fix by caculating in the pen width. Change-Id: I7a436e873f6d485028f6759d0e2c6456f07eebdc Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 84aba80944a2e1c3058d7a1372e0e66676411884) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* tst_QSslCertificate::verify - remove QSKIPTimur Pocheptsov2021-08-067-254/+121
| | | | | | | | | And re-generate certificates. Fixes: QTBUG-95429 Change-Id: Id970a0a9315d146d6dd1e66c9cff9b7d75657e2d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit e7ab17ade170a8fbc5061fffe5334b26cdc54ed3)
* Handle even more include in enum casesFabian Kosmale2021-08-061-0/+5
| | | | | | | | | | | | | | | The solution in d3ed7dac8aa2f4ede0c409254b9dd44842086be0 was needlessly complicated, and broke a valid use case. The issue of no identifier being available to parse after the include has been processed can instead be solved by moving the test for the closing brace after the include processing. Fixes: QTBUG-94790 Change-Id: Ieec4b89e1d117637f11479e8bddc4060f93da43d Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 87973325f1b99f2b25a5a0224e623803872ce2ef) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QFuture: fix result reporting in the filter modeSona Kurazyan2021-08-051-0/+59
| | | | | | | | | | | | | | After inserting a result into the result store, a wrong index for end is used for reporting the range of ready results. This has been fixed in Qt 6 in scope of 44ceb56455c82df3e6b1c9a2fa373cac14a039f8 already. The problem was noticed also for Qt 5 long time ago (see the comments of QTBUG-6799), so port the fix to 5.15. The relevant part for testing the fix is taken from the same patch. Fixes: QTBUG-83182 Change-Id: I99121732576befa9ec32f758746d9a22a30e4261 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* tst_QSslCertificate::verify - skip auto-testTimur Pocheptsov2021-08-021-0/+2
| | | | | | | | | | | as a temporary fix for suddenly expired certificates situation (to be regenerated). Task-number: QTBUG-95429 Change-Id: I00ad11cfd8824eeeffa2991dfcda6a7899726953 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 8d0e4a2e5c3627e2fd88f14ccc8b349668012685) Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Don't report results when the results list is emptySona Kurazyan2021-07-282-0/+36
| | | | | | | | | | | | | | | | | | When inserting items into the result store, a ResultItem is created, which stores a pointer to the results list and their size. If the size of the ResultItem is set to 0, it means that a single result is stored. In case of trying to report results via an empty list, the size is 0, so result store treats it as a single result. Added checks before storing the results to make sure that the result list isn't empty. Note that empty lists are allowed in some cases for the filter mode, because ResultStoreBase::addResults() knows how to handle those cases correctly. Task-number: QTBUG-80957 Change-Id: I399af4c3eef6adf82fea5df031fe9a9075006b1f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 08de1fb28153d8170b592796a84032897afa4206)
* Make QSqlRecord benchmarks non-fatuousEdward Welbourne2021-07-261-2/+6
| | | | | | | | | | | | | | | Because QBENCHMARK re-runs its block repeatedly, to get sensible data, the block needs to actually do something when repeated. Since these tests had blocks that looped while (qry.next()), they left qry at its end state, so such repeats tested nothing. Use seek(0) at the start of each cycle to actually do the work repeatedly when the block is repeated. As a drive-by, split a long line. Task-number: QTBUG-91713 Change-Id: Id46f77dc5e71335871af79ff61e1980b5f636179 Reviewed-by: Andy Shaw <andy.shaw@qt.io> (cherry picked from commit 432eab3bc09bd4c6e6904905fae53f64227a1518) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Halve the data-set size of tst_QSqlRecord::benchmarkRecord()Edward Welbourne2021-07-261-1/+2
| | | | | | | | | | | At 1000, the set-up was taking longer than the five minutes QtTestLib's WatchDog allows, so the test got killed. Task-number: QTBUG-91713 Change-Id: Ia3c85b223fc917ad5817364505cbffe50d67ddc6 Reviewed-by: Andy Shaw <andy.shaw@qt.io> (cherry picked from commit 346bdc6143dfe79a4b02a5fc410a8963b3d0c1f9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* H2: emit encrypted for at least the first reply, similar to H1Timur Pocheptsov2021-07-211-0/+9
| | | | | | | Fixes: QTBUG-95277 Change-Id: I1fe01503376c0d6278e366d7bd31b412b7cc3a69 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit c23b7886348dc313ccec1a131850a7cce1b429de)
* QFile benchmark: only set up and tear down the data directory onceEdward Welbourne2021-07-211-99/+73
| | | | | | | | | | | | | | | | | | | | | | | | None of the tests modify the data, so there's no risk that one test will cause another to fail via that. We can thus avoid the repeated cost of that set-up and teardown, which was done repeatedly for each test function since benchmarks get run repeatedly if they're quick. Use QTemporaryDir to manage the test data, so that it's tidied away automagically, instead of trying to tidy up at the end of each test (which was, of course, skipped if the test failed). As drive-bys, fix a typo in a QFAIL()'s message, change some C casts that silently bulldozed const away to reinterpret_cast<>s with the const qualifier and turn some heap buffers into stack buffers to save the need to delete [] them at the end of their tests (also skipped on failure). Inspired by a kindred change by Andreas Buhr and a suggestion on its review by Friedemann Kleint. Change-Id: I6067eb35babfbac02990ef39817b0d5122f563cd Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> (cherry picked from commit e1b3a463024b8e243f743cffefc9f1a7e6998a6c)
* Unify and clean up two identical tst_qfile::*_data() functionsEdward Welbourne2021-07-211-57/+41
| | | | | | | | | | | Convert newRow() to addRow() to simplify formatting, use a ranged-for iteration, take out a common factor of 1024, use QByteArray instead of roundtripping ASCII via Unicode, and break some long lines. Change-Id: I052730a71fb74f40a0dbd0695dcc286bc39896fb Reviewed-by: Jason McDonald <macadder1@gmail.com> Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> (cherry picked from commit f1d40ca5e9b635e565bcaba5fb2a95f065478b51)
* Move QSKIP()s to _data() functions in QFile benchmarkEdward Welbourne2021-07-211-24/+11
| | | | | | | | | | | Skipping once in the data function is the clean way to do this. Saves setting up dummy data just so as to skip it, or setting up real data and then skippin on each row. Change-Id: I1666d134b6f206e8055fbbc5efd2e2116431a9c1 Reviewed-by: Jason McDonald <macadder1@gmail.com> Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> (cherry picked from commit 1cabfd168048b6b76b406015cc5a5c28e8f38cf0)
* QNetworkDiskCache: Fix tracking of size during storeItem()Mårten Nordheim2021-07-201-10/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | If the file already existed we simply removed the old one without adjusting the size. So use the removeFile() function which takes care of that. Additionally, if the current size was non-null we previously increased the size (presumably meant to be temporarily but wasn't) and called expire() which would either: 1. not do anything and return currentCacheSize, if it was not greater than the max size. This would mean that the size of the file would be counted twice. or, 2. discard currentCacheSize, measure the size of the items, and then remove some items if the total size surpassed the max cache size Neither of those branches need us to (temporarily) increase currentCacheSize. It also doesn't attain the (presumed) goal of trying to keep below the max cache size after having added the new item. Fixes: QTBUG-95009 Change-Id: I2b5b13ff473a7aa8169cf2aecfea783c97f2d09a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit d9f80502f6450f0bc8e6d7ca13e1c912ad485599) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix qdbusperformance and qprocess benchmarksEdward Welbourne2021-07-194-5/+11
| | | | | | | | | | | | | | | | | | | | | | | The tests failed on 5.15 for different reasons than they do on dev, so this cherry-pick is significantly modified. Only changes to qmake configuration (absent on dev) were needed, but this reworking includes such of the C++ code changes as are still a benefit, too. The 5.15 failures were due to mis-configuring qmake: the qprocess test's server was told it was a benchmark; the qdbusperformance benchmark didn't know that was what it was. Both tests called a QProcess::start() overload that was deprecated at 5.15 (even though the code still compiles just fine after removal of that overload at 6.0), so silence the warning by passing an empty QStringList(). Add the ".exe" suffix for QProcess's server path and apply QFINDTESTDATA() to it. Task-number: QTBUG-91713 Change-Id: I5ace23a5815575bbf88ea88e0b16afc7b8ba6a08 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit bf99c2b62bc3bc2dc10ba8f98bea0496b2026801) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QListView: don't scroll if selected items are removedVolker Hilsheimer2021-07-171-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | For SingleSelection, removing the selected item will select the nearest item and, if autoScroll is enabled, ensures that the newly selected item is visible in the viewport. This may result in scrolling. For Multi- or ExtendedSelection, this should not happen, as having no selection is perfectly fine in those modes. However, QListView still tried to scroll to the current item in response to the currentIndexChanged signal. Since the currentIndex is at this point already hidden, the rectangle for it became invalid, and the attempt to scroll resulted in a one-pixel up-movement of the viewport (since the invalid rectangle has width == height == -1). Fix this by not scrolling if the rect for the index is invalid. Note that the index is still valid at this point, so we can't shortcut the call stack earlier. Add test that exercises the different combinations of ViewMode and SelectionMode, and demonstrates the one-pixel movement without the fix. Fixes: QTBUG-94788 Change-Id: I1f36973eadb46e8c9b8b8068bc76ee09e9f490dd Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 26bebd2037eb69f7c939c899e3238a3e0f0a2376) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Don't mangle QByteArray settings with @ prefix by decoding as UTF-8Tor Arne Vestbø2021-07-121-0/+4
| | | | | | | | | | | | | | | | | | | QSettings encodes QVariants as @Type(data) strings. If that data contains a null-byte, we write the string as UTF-8 encoded CFData. When reading it back we look for a @ prefix, and then pass it as UTF-8 through stringToVariant. The problem arises then the user writes raw QByteArrays with a @ prefix. We can detect this situation by checking the result of stringToVariant, and if it's just a simple conversion of the string into a QVariant, we know that stringToVariant hit its fallback path due to not finding any embedded variants. If that's the case, we return the raw bytes as a QByteArray. Change-Id: I4ac5c35d0a6890ebea983b9aca0a3a36b0143de2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 3eac6079d9a02fbedd3740186eaaf21134dc45c2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* tst_QtConcurrentThreadEngine: fix the threadCount() testSona Kurazyan2021-07-121-8/+4
| | | | | | | | | | | | | | | | Enable the check, that has been disabled because of instability, which makes the test-case useless. The reason for instability probably was that it doesn't always start maxThreadCount number of threads: it could be less if the workers reuse the thread pool's already created threads (if possible) instead of creating new one each time. But we can at least make sure, that we're not starting more threads than expected. Task-number: QTBUG-94463 Change-Id: I8e498c377d86c49758bde0114fe6f7e0432fe993 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> (cherry picked from commit 42f2a9c5ce8b28186960499ad92754c40aa04ac5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix auto completion in QFileDialog on WindowsVolker Hilsheimer2021-07-101-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Amends c0b3c06a7d4f6a2f90742e8dc81c898082a70416. The QCompleter used by QFileDialog uses starts-with matching of the path parts, for all parts of the path. It uses the EditRole of the underlying model for the data to match. The path parts used for a path on Windows are "C:", "Users", "etc...", and then finally whatever input has been typed so far. If we try to match that against a starts-with rule against "Local Disk (C:)", then it will fail and the completer will never have anything to show. So, for the EditRole, return just the volume drive letter as we did before c0b3c06a7d4f6a2f90742e8dc81c898082a70416, not the volume name. Neither can be edited anyway. This happens to then match the native file dialog behavior, which doesn't complete "L" to "Local Disk (C:)" if the Computer contents (ie. volumes) are shown. Augment the QCompleter test case to cover that scenario (it already has everything set up for this particular combination, even though we are actually testing QFileSystemModel returning the correct data). Fixes: QTBUG-94799 Task-number: QTBUG-78043 Change-Id: I14844d91601e9b16dc07cff2ca48713acb7cdd09 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit d2e88b8094db0bda6b3ab89172352861ae18d301) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QFile benchmark: always use Unbuffered for QFSFileEngine testsEdward Welbourne2021-07-091-7/+5
| | | | | | | | | | | Support for buffered usage with QFSFileEngine was dropped in 5.10; trying to use it triggers an assert. Task-number: QTBUG-91713 Change-Id: I5f46e9f793310538344b96bf2efbeba34098de83 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit f74b2e3479751cd9ef86c0c38c8c64172c1129f7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QDirIterator benchmark to actually find its test dataEdward Welbourne2021-07-091-15/+14
| | | | | | | | | | | | | | | | | | | | The benchmark had a hard-coded path on MS and needed an environment variable set otherwise; neither sounds like a good approach, when testlib defines a variable that tells us the test's source directory, a clearly superior way to find things in our source directories. In the process, replace exit()ing on failure to get a path with a QSKIP() so that the test at least fails gracefully if it ever can't find its data. (Using QFAIL() left it with no rows but still trying to run the test, leading to an assert failure.) 5.15 backport replaces QT_TESTCASE_SOURCEDIR with a search for the source tree's qdiriterator.pro using QTest::qFindTestData(). Task-number: QTBUG-91713 Change-Id: I1bd5561971239bb838bcf6c24bcdf1d07c81a657 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 74e9b77f4f3bd823d836a2a1a557b294582bac5e)
* Remove the dead code for blocking methods from QtConcurrentSona Kurazyan2021-07-082-106/+28
| | | | | | | | | | | | | | | After 79fd1cb2c631b6084bf10874205d27f5b53c907a the methods for running QtConcurrent algorithms in the blocking mode aren't used anymore. Since ThreadEngineBase and ThreadEngineStarter classes aren't meant to be used externally, it should be fine to remove startBlocking() methods now. Removed the unused code and adjusted the tests accordingly. Change-Id: Ifb13820ce207869d6f720bcb5be8d35bb355fe33 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit 1bf75f2a661c05c7f1126187310d7df3f9704af5)
* Fix placement of placeholder text in QLineEdits with action iconsVolker Hilsheimer2021-07-081-0/+66
| | | | | | | | | | | | | | | | | | | | | After dc794f7622bc00f7ca50fab65d6965695d6d2972, side widgets only got space if they were not fading out, but the logic was not correctly accounting for side widgets that never fade, such as buttons added via QLineEdit::addAction. Fix this to give visible widgets space, unless they are fading out. That was the intent of the original change. Rename the variable to make its purpose clearer, and reset it at the end of the fade-out animation. Add a much-needed test that relies on private APIs to verify that the effective margins are calculated correctly. Fixes: QTBUG-94824 Change-Id: If2ee6be52be9e4f9be1e91f72f27681ce27def6d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 0e6b31019f01c72ea3af3de31095f8269c7d7f30) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QString: Respect precision when reading data for %.*s format stringUlf Hermann2021-06-231-0/+30
| | | | | | | | | | | | If we disregard the precision we may read a very large string that we subsequently discard. Furthermore, people use this to read non-null-terminated strings, which randomly crashes. Change-Id: Ifa255dbe71c82d3d4fb46adfef7a9dc74bd40cee Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit e99e07cb5c939ca5bbb1dfdeb66c862d6cd4f2f2) Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>