summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Purge empty methods from tst_QSqlRecordEdward Welbourne2021-07-231-17/+0
| | | | | | | There's no point mentioning empty init(), constructor and destructor. Change-Id: I0b820f62fd46a955aae891adfc68ca366ca60672 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Select PostgreSQL-only data, rather than filtering in the testEdward Welbourne2021-07-231-19/+17
| | | | | | | | | | | | Two QSqlRecord benchmarks that are only relevant for PostgreSQL were being run for all backends, without producing useful results for the others. Since the test is data-driven and the generic data-table code can take a backend-name to decide which to include, pass a suitable string to the generic data method instead, so that we now simply skip these tests (and say we're doing so) rather than "passing" them. Change-Id: I2223c16007a7095a9cadd13a9b2d46813507a35f Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Rename QSqlRecord benchmark's source file to match its test nameEdward Welbourne2021-07-232-2/+2
| | | | | Change-Id: I580f185b3bbe283dfa2f43bbc986233d01219814 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Make QSqlRecord benchmarks non-fatuousEdward Welbourne2021-07-231-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. Pick-to: 6.2 6.1 5.15 Task-number: QTBUG-91713 Change-Id: Id46f77dc5e71335871af79ff61e1980b5f636179 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Halve the data-set size of tst_QSqlRecord::benchmarkRecord()Edward Welbourne2021-07-231-1/+2
| | | | | | | | | | At 1000, the set-up was taking longer than the five minutes QtTestLib's WatchDog allows, so the test got killed. Pick-to: 6.2 6.1 5.15 Task-number: QTBUG-91713 Change-Id: Ia3c85b223fc917ad5817364505cbffe50d67ddc6 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Convert QLocalSocket benchmark to use QTestEventLoopEdward Welbourne2021-07-231-10/+17
| | | | | | | | | | | Now that this event loop pays attention to test failures, we can avoid the time-outs that used to happen on test failure. Also check for premature failures (but don't return early, so we can shut down the server gracefully) and give the event-loops sensible time-outs. Task-number: QTBUG-91713 Change-Id: Ib895a5fba0f22654c7fecf996f23649a4b5ce0de Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
* Assert some more things we can be sure of in the QMap benchmarkEdward Welbourne2021-07-231-0/+17
| | | | | | | | | Just in case the test isn't testing what we think it is. One of my earlier changes didn't until this told me about it. Change-Id: Idd6f415d543509cabb3a64219736bb43e60a70ef Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* QMap benchmark: use unsigned accumulators and check themEdward Welbourne2021-07-231-4/+12
| | | | | | | | | | | | | | | | | | | The sum of the first 100000 naturals is more than 2^32, so using an int accumulator to collect the values is susceptible to overflow, which is UB for signed integral types. So switch to an unsigned type. We don't care about the actual sum, only having the various map entries we fetch "used". Since unsigned arithmetic is well-defined even when it overflows, we can calculate the expected sum and verify it, to ensure that no matter how clever the optimizer, it won't throw out the accumulator as written but not read (and then optimize out all the tested code). As a drive-by, rename one of the accumulators to match the rest. Change-Id: I93a2825247c96ca88fe52fdb7ce1e5456eebad54 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Rename QMap benchmark source file to match test nameEdward Welbourne2021-07-232-2/+2
| | | | | | | | s/main/tst_bench_qmap/g Change-Id: Ic520254f5b5f946f4eaa234352317749a9a7301f Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Give symbolic names to the sizes of data-sets tested in QMap benchmarkEdward Welbourne2021-07-231-24/+27
| | | | | | | | | Mostly so that I can put comments on them to indicate why some tests are bigger and others not so big. Change-Id: I633ceb264aa96ee8f5345e3f342a518e8ae4838b Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Make QFutureWatcher::isFinished() consistent with the watched QFutureSona Kurazyan2021-07-231-25/+50
| | | | | | | | | | | | | | | | | | | | | All the getters of QFutureWatcher are consistent with the getters of the corresponding QFuture, except for the isFinished() method, which returns 'true' only after the finished() signal is delivered. This behavior might be unintuitive for the users. In particular, isFinished() returns 'false', even if it's called immediately after waitForFinished(). [ChangeLog][QtCore][QFutureWatcher][Important Behavior Changes] The QFutureWatcher::isFinished() method now indicates if the related QFuture is finished, instead of indicating if the finished() signal was delivered. This makes it consistent with the future that is being watched. Fixes: QTBUG-91048 Pick-to: 6.1 6.2 Change-Id: I6ae9b882b23e06198a82c95b026491bd480b3bf0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add benchmarks for QString::numberMårten Nordheim2021-07-222-3/+133
| | | | | | | | | While we're here: - remove the GCC precondition for compiling this benchmark. Task-number: QTBUG-88484 Change-Id: I14f3ea7e4708e274d032a6297e9d4a87ae5dc1c0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Use QChar::fromUcs4(i) rather than QChar(i) on out-of-range iEdward Welbourne2021-07-221-16/+28
| | | | | | | | | | | | | | | | | | | Follow-up to commit 915be6606ead25f4fbbbcb2687b33cf22a955177, catching some benchmarks that took for granted they can assign an arbitrary int to QChar. Since 6.0 this has triggered an assertion. Given the choice between limiting the range (from 100000 to 0x10000) and actually handling the out-of-range values as UCS-4 data, the latter seemed like a more interesting test. At the same time, take the construction of the strings out of the loop, as that's not a QMap performance matter, it's a QString one. Pick-to: 6.1 6.2 Task-number: QTBUG-91713 Change-Id: Id6abab08b5c879f0f764350f66d6aa1dd9f1620a Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Sync default action when checking tool button programmaticallyVolker Hilsheimer2021-07-221-0/+59
| | | | | | | | | | | | | | | | | | | | | | QAbstractButton::setChecked is not virtual, so QToolButton cannot override to synchronize the default action's checked state. This resulted in button and default action not being in sync when the checked state of the button was changed programmatically, while changing the checked state on the action kept the button in sync. Connect to the button's own toggled signal instead to keep the state of the default action in sync. Make it a unique connection to allow multiple calls to setDefaultAction, which are used by QToolButton to keep the button updated if properties of the default action change. Add a test that confirms that button and action are synchronized both ways, and that we only get single signal emissions when changing either programmatically. Fixes: QTBUG-95255 Pick-to: 6.2 6.1 Change-Id: I0e027faf1da763ef1878e46e85bfa70073c8bf82 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QSet: extend testsIvan Solovev2021-07-221-5/+172
| | | | | | | | | | | Extend tests to explicitly check the behavior of empty default-constructed container. Also add some missing tests to increase the code coverage. Task-number: QTBUG-91736 Pick-to: 6.2 6.1 Change-Id: Ie57b5d13fad9a846c29c87be4985c87e69bba305 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QString: extend unit testsIvan Solovev2021-07-221-74/+495
| | | | | | | | | | | | | | | | This patch introduces some test improvements to check the calls of different methods on an empty default-constructed string. Apart from that, some other tests are added to extend code coverage. As a drive-by: * fix int -> qsizetype in the test data * fix int -> enum in the test data Task-number: QTBUG-91736 Pick-to: 6.2 6.1 Change-Id: I159473b7f5dcbea1bdaf2966979e066296351208 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* CMake: Disable test_QT_TESTCASE_BUILDDIR cmake build testAlexandru Croitor2021-07-221-4/+8
| | | | | | | | | | | | | | | | | | | | | CMake 3.21.0 + Ninja now pass absolute source file paths to the compiler which causes __FILE__ to be absolute and qFindTestData to ignore any QT_TESTCASE_BUILDDIR value. This causes the test to fail, because it won't find test data in the custom specified location. Disable the test for now. Amends 70464b355ec1c7007e0b1291f733e2540ba1825f Pick-to: 6.2 Task-number: QTBUG-95268 Task-number: QTBUG-95018 Change-Id: If99035e897ac1d5f153d4e19c94e4355f88970af Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: Fix Windows resource compiler failure in selftests with MinGWAlexandru Croitor2021-07-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The MinGW resource compiler fails to handle compile definitions with multiple values. When the resource file is compiled as part of the main target rather than a separate object library, the resource generation rule will inherit all the compile definitions from the main target. For the case of tst_selftests this causes errors like gcc: error: badxml\: No such file or directory gcc: error: benchlibcallgrind\: No such file or directory gcc: error: benchlibcounting\: No such file or directory gcc: error: benchlibeventcounter\: No such file or directory gcc: error: benchliboptions\: No such file or directory Limit the compile definition to the C++ language only, so the multiple values are not passed to the resource compiler. Pick-to: 6.2 Change-Id: Ie53666839272556323b50d79c090f0dc71745d11 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Don't slow down a QMap benchmark by growing a megabyte-long stringEdward Welbourne2021-07-211-1/+1
| | | | | | | | | | | | | | Change a += to simple assignment where it's string arithmetic (a hundred thousand concatenations of "Hello World" add up to more than a megabyte, in an incremental growth that's going to dominate the QMap operations we were meant to be benchmarking) and the only reason for it is to avoid an unused result warning. Accumulating int values is harmless, but strings are another story ! Pick-to: 6.1 6.2 Task-number: QTBUG-91713 Change-Id: Ib0dc131b0cc75fea23998afc0300e8cb60076c7e Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* QFileSelector: Preserve path to root directoryFabian Kosmale2021-07-211-0/+3
| | | | | | | | | | | | | | | | While QFileSelector is documented to work on files, select accepts arbitrary URLs. Moreover, the QML engine can end up intercepting arbitrary (user provided) URLs, including to directories. Prior to this change, passing "file:///" or "/" to the function would break: We would temporarily get a "//" path, which is invalid, and thus we would return an invalid in the end. Prevent this by only appending a slash to the path when it doesn't have one. Fixes: QTBUG-85410 Pick-to: 6.2 Change-Id: I1d2807a9d225df611c3a5e871e3c1d90a6a25953 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QString benchmark: rename the source fileMårten Nordheim2021-07-212-2/+2
| | | | | | | 'main.cpp' is quite generic when using search to look for it. Change-Id: I547ba16a11db8efb7d4410b94343b03d30da6513 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix QtConcurrent to properly work with functorsSona Kurazyan2021-07-212-207/+421
| | | | | | | | | | | | | | | QtConcurrent reduce functions were requiring to explicitly pass the the result type when passing functors as reductor. This was because of inability to deduce the result type from the functors. The result type of the QtConcurrent reduce functions should match with the type of the fist argument of the operator() when a functor is passed. Reused the ArgResolver type trait (already used for QFuture and QtConcurrent::run) to find out the result type in that case. Task-number: QTBUG-88448 Change-Id: Ief0eeee197df8cb9c30f3403d71978f36e4fb0f2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* emit layoutAboutToBeChanged timelyLuca Beldi2021-07-2010-2/+465
| | | | | | | | | | | layoutAboutToBeChanged must be called before persistentIndexList as the user might create persistent indexes as a response to the signal Fixes: QTBUG-93466 Pick-to: 6.2 5.15 Change-Id: I73c24501f536ef9b6092c3374821497f0a8f0de4 Reviewed-by: David Faure <david.faure@kdab.com>
* QNetworkReply: Add two new signalsMarkus Goetz2021-07-202-0/+129
| | | | | | | | | | | These signals allow monitoring where in the HTTP1/HTTP2 flow a request is currently in. Fixes: QTBUG-71698 Fixes: QTBUG-18766 Change-Id: Icc2fe435afc9f680fa7a76c32731e25fcdfeb4b4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tst_QSslSocket: fix and clean up allowedProtocolNegotiationMårten Nordheim2021-07-201-10/+4
| | | | | | | | | | | The server's socket may not have been created yet, so use the server's signal instead. Switch to QCOMPARE to get better output. Delete the extra checking for schannel, we don't support Windows 8 anymore. Pick-to: 6.2 Change-Id: Icd310c32939cb577c9f3438789f667aa0a3a4d85 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* 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 Pick-to: 6.2 6.1 5.15 Change-Id: I2b5b13ff473a7aa8169cf2aecfea783c97f2d09a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QHash, QMultiHash: extend testsIvan Solovev2021-07-201-12/+532
| | | | | | | | | | | | | | Extend tests to explicitly check the behavior of empty default-constructed containers. Also add some missing tests for the existing methods (mostly for QMultiHash) and correct some end()s to cend()s in comparisons. Task-number: QTBUG-91736 Pick-to: 6.2 6.1 Change-Id: Ic9e1b86ef67f6bca2751a65a8589b2f7e0ebb5ea Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* H2: emit encrypted for at least the first reply, similar to H1Timur Pocheptsov2021-07-201-0/+9
| | | | | | | Pick-to: 6.2 6.1 5.15 Fixes: QTBUG-95277 Change-Id: I1fe01503376c0d6278e366d7bd31b412b7cc3a69 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Skip tst_qthreadonce test on QEMUSona Kurazyan2021-07-202-0/+11
| | | | | | | | | | | | The test causes frequent failures in the CI. Couldn't reproduce on actual arm64 hardware, so it's likely to be a QEMU bug. From the available logs it seems that all the test cases are flaky (there's a failure even after cleanupTestCase() is called), so disable all of them. Fixes: QTBUG-94737 Pick-to: 6.1 6.2 Change-Id: I783ec2179ba779a2c8d93351a78e8472a4f7a907 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Support pt units for sizes, as documentedVolker Hilsheimer2021-07-201-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | Declaration::lengthValue only supported 'px' sizes, but one can transform any 'pt' value into 'px' by multiplying with 1.33. Notes: this ignores display DPI, and instead follows the W3C definition of 'pt' and 'px' as absolute lengths [1]. [1] https://www.w3.org/TR/css3-values/#absolute-lengths 1pt = 1/72th of 1 inch 1px = 1/96th of 1 inch so the conversion is px = pt * (72/96). Add unit test that verifies this using QPushButton's icon-sizes property, also with changed font in preparation of adding support for 'em' and 'ex' units in a follow up commit. Task-number: QTBUG-8096 Pick-to: 6.2 Done-with: Cristian Maureira-Fredes <Cristian.Maureira-Fredes@qt.io> Change-Id: I58782e7ad0e2ff9d89ed695f8a23b1e584cfed64 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* QList: extend testsIvan Solovev2021-07-201-13/+428
| | | | | | | | | | | | | | This patch mostly introduces some test improvements to check the calls of different methods on an empty default-constructed container. Apart from that some other tests are added to extend test coverage. Task-number: QTBUG-91736 Pick-to: 6.2 6.1 Change-Id: If2bc96158462292bbdf8504942141af94568c729 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* tst_qlocale: Add tests for parsing Chakma date and time stringsIevgenii Meshcheriakov2021-07-191-0/+16
| | | | | | | | | | | | Add tests to verify parser behavior with locales that use code points outside of Unicode BMP to represent dates. ccp is used for this because Chakma language uses code points outside of BMP for both letters and digits. QDateTimeParser currently is not able to handle this locale correctly, so the tests are marked as expected failures. Task-number: QTBUG-87111 Change-Id: I1cc6fe7304b47f19950ae0ad3179c4ffa946adb3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Allow to set TCP network listen(2) backlogDaniel Nicoletti2021-07-192-4/+4
| | | | | | | | | | | | | | | | | | | | Qt has a hardcoded backlog value of 50, this allows for applications to tune this value. Modern kernels have the SYN cookie feature that reduces pressure from an flood attack, the backlog setting however is then a queue for most likely real completed (SYN/ACK) connections hence, it's easy to get clients connections dropped with this very small limit. [ChangeLog][QtNetwork][QTcpServer] Added QTcpServer::setListenBacklog() to be able to have control over the listen backlog feature. Change-Id: I1c78af6d99e012591e214b7e09fa85c485880d48 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Rename QVector benchmark and its main.cpp for consistencyEdward Welbourne2021-07-192-4/+4
| | | | | | | | | The usual pattern (at least in corelib) is tst_bench_[lowercased class-name] for the test and the same with .cpp for the source-file name. So s/(main|tst_bench_vector)/tst_bench_qvector/g Change-Id: Ic9bd3ac87adfaec189409c2259cc674ebcec602c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Clean up old QVector benchmarkEdward Welbourne2021-07-193-225/+68
| | | | | | | | | | | | Purge comments showing assember from an antique g++ version, skip #if-ery that's always been on, so makes no difference, rename two single-letter variables shared between files, move some extern declarations to a header, wrap parts of a source file in QT_{BEGIN,END}_NAMESPACE, add a TODO against an antique commented out #if-ery kludge. Change-Id: Ic4781960e0c9838027c21d3d392a50f29598132c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Suppress a broken benchmark comparing QVector to std::vectorEdward Welbourne2021-07-192-6/+15
| | | | | | | | | | | | | | | | The test constructs an ersatz object with which to overwrite a QVector's internals, but based it on Qt 5's memory layout. Since Qt 6 completely rearranged that memory layout, the test now crashes (or, in a debug build, trips over an out-of-bounds assertion). So suppress the test until those who perpetrated it and/or the reworking of QVector's internals can work out how to fix it. That way, QA can at least run the benchmark without crashing. Task-number: QTBUG-95061 Pick-to: 6.2 Change-Id: I0e8c8d58f2002497f6e29d0ad25f840e207704a4 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Rename QFile benchmark's source file to tst_bench_qfile.cppEdward Welbourne2021-07-192-2/+2
| | | | | | | Let's have fewer files with the same main.cpp name. Change-Id: Iad94478affcca73a25ed29ba4380f1b3ca4f329d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Drop pointless parentheses from round case labelsEdward Welbourne2021-07-191-20/+20
| | | | | Change-Id: I5339523f83aea4d91aaec9bd2570b225287ae23a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Replace Q_FOREACH() with ranged-for loopsEdward Welbourne2021-07-191-20/+16
| | | | | | | | | In the process, fix two coding-style violations: while loops whose empty bodies were given as a semicolon rather than as empty braces. Also ditch some spurious braces. Change-Id: I2734077f4f54985c4e8d81f846c1fa6fac4f529d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QFile benchmark: only set up and tear down the data directory onceEdward Welbourne2021-07-191-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. Pick-to: 6.2 6.1 5.15 Change-Id: I6067eb35babfbac02990ef39817b0d5122f563cd Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
* tst_QComboBox: fix -Wsuggest-overrideMarc Mutz2021-07-181-1/+1
| | | | | Change-Id: I6fce7f84cf1578ac0e4ee0b2d7da579b54d78ec3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use member function instead of template function to resolve native interfaceTor Arne Vestbø2021-07-171-8/+10
| | | | | | | | | | | | | | The use of a freestanding function is not needed now that the name doesn't alias the nativeInterface accessor function, and was just adding complexity to the machinery. People not familiar with the code will have an easier time following the flow through the helper member function, and we no longer need to declare our own export macros. Pick-to: 6.2 Change-Id: I17530b7e89939cfc19ab8ffaa076b7129ae02dcf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* tst_QGraphicsScene: fix compiler warning about misleading indentationMarc Mutz2021-07-171-4/+4
| | | | | Change-Id: I532b5eeb0d4f9632f517deef61a7528bcb4151c6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QListView: don't scroll if selected items are removedVolker Hilsheimer2021-07-161-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 Pick-to: 6.2 6.1 5.15 Change-Id: I1f36973eadb46e8c9b8b8068bc76ee09e9f490dd Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Skip trailing space on ends of QFile benchmark namesEdward Welbourne2021-07-161-3/+6
| | | | | | | | | | They were there to make it easier to build the names. Avoiding them wasn't exactly hard. Change-Id: I9e353644d81f80d69ecf73fe4fa875948ccbc2c9 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
* QFile benchmark: purge fatuous function, inline several moreEdward Welbourne2021-07-161-39/+8
| | | | | | | | | The empty cleanupTestCase() was just clutter. Various tests that shared a common implementation (using different data) might just as well be inline in the class body. Change-Id: I5046d7e6ad5a6425df9f9e0a0a705e229d9d0717 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QMultiMap: extend unit testsIvan Solovev2021-07-161-143/+581
| | | | | | | | | | | | | Extend tests to explicitly check the behavior of empty default-constructed container. Also add some missing tests to increase the code coverage. Task-number: QTBUG-91736 Pick-to: 6.2 6.1 Change-Id: Ib3c3f5bcb967cd1031cb24ffceaa77a146212ffd Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Consistent handling of disabled items in QItemSelectionModelAndreas Buhr2021-07-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | In QItemSelectionModel, items which are disabled or marked as not selectable should not be considered as selected. But this was not handled consistently. The following methods considered only items which are enabled and marked selectable: selectedIndexes(), rowIntersectsSelection(), and columnIntersectsSelection(). The following methods considered only items which are marked selectable, but did not check whether they are enabled: selectedRows(), selectedColumns(), isRowSelected(), isColumnSelected(), isSelected(). Finally there is hasSelection(), which did not check for enabled nor for selectable. This patch introduces consistent behavior. All methods check both whether the items are enabled and whether they are selectable now. [ChangeLog][QtCore][QItemSelectionModel][Important Behavior Changes] All methods in QItemSelectionModel now consider only items which are marked as enabled and selectable as part of the selection. Fixes: QTBUG-93829 Pick-to: 6.2 Change-Id: I4725243ea6b0db4f289ce34ada22c7a9d3282713 Reviewed-by: David Faure <david.faure@kdab.com>
* QCryptographicHash: use a std::array to hold result (was: QByteArray)Marc Mutz2021-07-151-6/+6
| | | | | | | | | | | | | | | | | | | | | | The maximum size for a hash result is 64 atm. Even if, and esp when, we'll get to 128 and 256 bytes in the future, there's no reason to use dynamic memory, because the sizes will always be statically known. So use, essentially, a std::array<char, 64> to hold the result internally. Add a bit of convenience API on top to limit impact on the rest of the code and add a few static_asserts that ensure this is large enough. Then give users access to the internal buffer by adding QByteArrayView resultView() const noexcept. The documentation snippet is taken from QString::data(), suitably adjusted. Use resultView() in a few places instead of result(). [ChangeLog][QtCore][QCryptographicHash] Changed to use a statically-sized buffer internally. Added resultView() to access it. Change-Id: I96c35e55acacbe94529446d720c18325273ffd2f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QCryptographicHash test: remove the moreThan4GiBOfData(SHA512) check from the CIMarc Mutz2021-07-151-2/+5
| | | | | | | | | | It timed out the other day on the CI. Even the SHA-1 check took 137s (with a 300s timeout). Skip the SHA-512 test on the CI, but keep it for manual runs. Pick-to: 6.1 6.2 Change-Id: I49792ac9bcab6512e1803f66cd986b2830e634c0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>