summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* rhi: Make sure pixelSize() to a texture rt is always up to dateLaszlo Agocs2022-01-251-24/+42
| | | | | | | | | This is an issue for QQuickWindow in practice, although it is not hit by our current tests. Pick-to: 6.3 Change-Id: Ia73704c1af6a82b2689ce7b844d3b0eb9a17ec18 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Fix memory leak in QtConcurrent::run when called with a NULL QThreadPoolSona Kurazyan2022-01-241-0/+23
| | | | | | | | | | QThreadPool automatically deletes the runnable after it finishes running the task. In case QThreadPool is nullptr, we should delete the runnable manually. This amends 87b93c29be02f0a7ff9424b5e2b6431e20bd4c40. Pick-to: 6.3 6.2 5.15 Change-Id: Id7e4ed3d4d6de05990edf62e4099852983debc64 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QByteArray benchmark: fix clang -Wmove-resultMarc Mutz2022-01-241-1/+1
| | | | | | | | | | | | | | | | | Take the argument by value instead of rvalue ref. In C++17, this is as efficient, and enables the return big; to use the QByteArray move constructor, avoiding the need for a manual std::move(), which always looks suspicious on a return statement, because more often than not, it's a pessimization that breaks NRVO. This code doesn't seem to exist in Qt 6.2, so only Pick-to: 6.3 Change-Id: I8bf678102f5df1870cfc61090d12f327478d74d1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* benchmarks: fix some (future) -Wunused-result warningsMarc Mutz2022-01-243-28/+28
| | | | | | | | | | | | | | | | | | | | Clang 10 warns about unused results of relational operators, which is where this is coming from. Fix by adding the usual prefix [[maybe_unused]] auto r = ~~~; to silence the warning. Do this elsewhere, too, since [[nodiscard]] is slowly being rolled out across all our APIs. This is not a complete sweep, though. Not picking to 5.15, because this pattern doesn't work there and I don't want to introduce a new one. Pick-to: 6.3 6.2 Change-Id: I40dd8ad07496b686979dce533e044cbb486e30f3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* tst_bench_qlocalsocket: fix Clang 10 warnings about unneeded captureMarc Mutz2022-01-241-2/+1
| | | | | | | | | | | | | | | | The timeToTest constant doesn't need to be captured, claims Clang. Since I don't recall seeing this warning on GCC, be pragmatic and fix by letting the compiler choose what to capture: [&]. timeToTest is const, so it doesn't matter whether we capture by reference or value, the lambda cannot change it either way. This code doesn't seem to exist in 5.15, so merely Pick-to: 6.3 6.2 Change-Id: I48d42ab13ed22ac5eb512dc61235b72a19636ea3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QTransform benchmark: measure what was promisedMarc Mutz2022-01-241-1/+1
| | | | | | | | | | | | The function name suggests that the *= operator is to be benchmarked, not simple multiplication. Use the correct operator. Pick-to: 6.3 6.2 5.15 Change-Id: I6718e8aea640a153083858b39963199e7bab26e9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Mark ResultStoreBase as finalSona Kurazyan2022-01-242-55/+146
| | | | | | | | | | | | | The class is not intended for inheriting from it (see also e5029063057c38297f188ccfefef7b1bcd781a76), so we can mark it as final to explicitly forbid this. The tests were still using it as a base class to clean the results during destruction, so fix them accordingly. Task-number: QTBUG-99883 Pick-to: 6.3 Change-Id: I4a7ee3e2b462bd704e4b5a95ed733144805d6e5b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Fix gcc warning in testsKai Köhne2022-01-241-0/+1
| | | | | | | | | | | | | Fixes /home/qt/work/qt/qtbase/tests/auto/corelib/tools/qcache/tst_qcache.cpp: In function ‘TestNamespace::quint64 qHash(TrivialHashType, size_t)’: /home/qt/work/qt/qtbase/tests/auto/corelib/tools/qcache/tst_qcache.cpp:491:41: warning: unused parameter ‘seed’ [-Wunused-parameter] 491 | quint64 qHash(TrivialHashType t, size_t seed = 0) | ~~~~~~~^~~~~~~~ Change-Id: I70446d3f53770162ec0b99f53695c11c7aac103f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Add layout in QRadioButton baseline test for better visualizationAxel Spoerl2022-01-241-0/+1
| | | | | | | Task-number: QTBUG-99749 Pick-to: 6.3 Change-Id: Iafd097d42b312cc24a60107c00e9c52fc0f3cdff Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Q(Static)ByteArrayMatcher: manage indexIn() overloadsMarc Mutz2022-01-231-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unlike QString and QStringView, QByteArrayView and QByteArray don't overload well. Solve the overload issue the usual way: by making the QByteArray one a Q_WEAK_OVERLOAD. This is trivial for QStaticByteArrayMatcher, which isn't exported, but require QT_REMOVED_SINCE magic for QByteArrayMatcher, which is. The additional const char* overload has shielded us from the worst fall-out so far, it seems, but it makes for a truly horrible overload set: matcher.indexIn(str, 3); Q: Is the 3 here the length of the haystack or the value of the from parameter? A: It depends on decltype(str)! If the (const char*, qsizetype, qsizetype=0) overload is the better match, then 3 limits the haystack's length. If, otoh, the (QByteArray(View), qsizetype) overload is the better match, then it's the value of the from parameter. As if this wasn't bad enough, QByteArray implcitly converts to const char* by default! A follow-up patch will therefore deprecate the (ptr, size) overloads, so we de-inline the QByteArrayView ones to avoid having to touch the implementation once more. Found during 6.3 API review. Pick-to: 6.3 Change-Id: I9640e0bdd298d651511adebcc85f314db9221d34 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QStaticByteArrayMatcher: fix searching in 2+GiB haystacksMarc Mutz2022-01-231-0/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a test (same techniques as for the 4+GiB check in tst_qcryptographichash). Takes ~1s to build the 4GiB test data here, and skips when RAM is too low: $ qtbase/tests/auto/corelib/text/qbytearraymatcher/tst_qbytearraymatcher haystacksWithMoreThan4GiBWork [...] QDEBUG : tst_QByteArrayMatcher::haystacksWithMoreThan4GiBWork() created dataset in 891 ms [...] $ (ulimit -v 2000000; qtbase/tests/auto/corelib/text/qbytearraymatcher/tst_qbytearraymatcher haystacksWithMoreThan4GiBWork) ********* Start testing of tst_QByteArrayMatcher ********* [...] SKIP : tst_QByteArrayMatcher::haystacksWithMoreThan4GiBWork() Could not allocate 4GiB plus a couple hundred bytes of RAM. Loc: [/home/marc/Qt/qt5/qtbase/tests/auto/corelib/text/qbytearraymatcher/tst_qbytearraymatcher.cpp(242)] [...] Found during 6.3 API review. [ChangeLog][QtCore][QStaticByteArrayMatcher] Fixed searching in strings with size > 2GiB (on 64-bit platforms). Fixes: QTBUG-100118 Pick-to: 6.3 Change-Id: I1df420965673b5555fef2b75e785954cc50b654f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use Q_INT64_C() to express qint64 constantsEdward Welbourne2022-01-211-3/+3
| | | | | | | | | | | When int is 32-bit, 0x80000000L is int-min, and (consequently) negating it makes no difference, so MSVC warns about this. Instead of using an L suffix, wrap the constant in Q_INT64_C(). Do the same for similar large constants in the same block. Pick-to: 6.2 6.3 Change-Id: Ib371b932792f170ab7db2e472a4283df3a205af3 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Remove flaky and duplicate animateClick testsVolker Hilsheimer2022-01-212-30/+0
| | | | | | | | | | | | | | The animateClick method is a QAbstractButton member, and neither QCommandLinkButton nor QPushButton override it. The method is tested in the QAbstractButton test, and 3a9b7d1f18648d7236664d3adfc65c009b01e668 made that test more robust. The previous, flaky version of the test was almost duplicated here. They add no additional code coverage, so remove them. Pick-to: 6.2 6.3 Change-Id: I1fa988c1eabd5054193acb1f5fa1c81d29b3878d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Tidy up tst_Warnings: comments and #if-eryEdward Welbourne2022-01-211-3/+9
| | | | | | | | | It was missing #if-ery on feature regularexpression for one test that depends on it. One of its comments had a long line. Added some annotations to make clear what's going on in messier tests. Change-Id: I06d8748a134591f93b36029713e52ffd826a24dc Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add QRadioButton test in tst_baseline_widgetsAxel Spoerl2022-01-211-0/+70
| | | | | | | Task-number: QTBUG-99749 Pick-to: 6.3 Change-Id: I89e759e0943b0d1793728a65bfbae6e6b4d3167a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use QPromise when creating continuations to avoid memory leaksSona Kurazyan2022-01-211-0/+1
| | | | | | | | | | | | | | | | | Continuations were using QFutureInterface to create and return the associated future to the user. Attaching a continuation to the returned future could cause memory leaks (described in an earlier commit). Use a QPromise when saving the continuation, to make sure that the attached continuation is cleaned in the destructor of the associated QPromise, so that it doesn't keep any ref-counted copies to the shared data, thus preventing it from being deleted. Task-number: QTBUG-99534 Pick-to: 6.3 6.2 Change-Id: I52d5501292095d41d1e060b7dd140c8e5d01335c Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix memory leaks when capturing a QFuture in its continuationSona Kurazyan2022-01-211-0/+62
| | | | | | | | | | | | | | | | | | | | | | Capturing a QFuture in the continuations attached to it results in memory leaks. QFuture's ref-counted data can only be deleted when the last copy referencing the data gets deleted. The saved continuation that keeps a copy of the future (as in case of the lambda capture) will prevent the data from being deleted. So we need to manually clean the continuation after it is run. But this doesn't solve the problem if the continuation isn't run. In that case, clean the continuation in the destructor of the associated QPromise. To avoid similar leaks, internally we should always create futures via QPromise, instead of the ref-counted QFutureInterface, so that the continuation is always cleaned in the destructor. Currently QFuture continuations and QtFuture::when* methods use QFutureInterface directly, which will be fixed by the follow-up commits. Fixes: QTBUG-99534 Pick-to: 6.3 6.2 Change-Id: Ic13e7dffd8cb25bd6b87e5416fe4d1a97af74c9b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* JSON: Further improve the duplicate handling in the parserUlf Hermann2022-01-215-10/+123
| | | | | | | | Avoid some unnecessary comparisons and add more tests. Task-number: QTBUG-99799 Change-Id: I3aee9f0b62461d38dadbe8e969444e1cd1f94e68 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* QFactoryLoader: add setExtraSearchPath() (for QPA plugins' use)Thiago Macieira2022-01-201-4/+35
| | | | | | | | | | | | | | | | | This is added specifically for the QPA platform and theme plugins, to honor the QT_QPA_PLATFORM_PLUGIN_PATH environment variable and the (inadvisable) -platformpluginpath command-line argument. This removes the last QFactoryLoader used with an empty path (also the only two that could be reached), which were causing a scan of the application's binary directory whenever the platform plugin path was set. In case of applications installed to /usr/bin, the entire /usr/bin was scanned, which can be qualified as "not good". Fixes: QTBUG-97950 Pick-to: 6.3 Change-Id: Ice04365c72984d07a64dfffd16b47fe1d22f26d3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Improve QAbstractButton::animateClick testVolker Hilsheimer2022-01-201-5/+28
| | | | | | | | | | | | | | The test is timing sensitive; if it takes more than 100ms to process events, then the timer that clicks the button might have fired. So only verify that the button is still down if 100ms have not yet passed, and verify that at least 100ms have passed when the click is complete. Also use QSignalSpy to test the signal emissions. Pick-to: 6.2 6.3 Change-Id: I95f99e204a17c6709f8e2913eefe4b487e949123 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Baseline: Move the paintcommands code into the shared directoryVolker Hilsheimer2022-01-205-5/+5
| | | | | | | | | It's used by the lancebench and the lance tool, and it will probably be useful for writing some high-dpi related unit and baseline test cases, so move it to the shared folder. Change-Id: I969bab51c9504be13b4c192b4f29f69cd9102868 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Add QCheckBox test in tst_baseline_widgetsAxel Spoerl2022-01-201-0/+57
| | | | | | | Task-number: QTBUG-99748 Pick-to: 6.3 Change-Id: I45fe3b102fba4dd6a6f8cd08bab5543f12265aa7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QTabBar: Improve scrolling with high resolution mouse wheelsNoah Davis2022-01-201-0/+45
| | | | | | | | | | | | | | | | | | | | | The current behavior for handling the angle delta of a wheel event changes index the instant there is a change in angle delta. This works fine for mouse wheels that send events with 120 angle delta units and there is also already behavior defined for devices with pixel deltas, but there is nothing good for handling events from high resolution mouse wheels that don't have pixel deltas. This patch makes it so that the current index doesn't change until the accumulated angle delta for the X or Y axis reaches 120. [ChangeLog][QtWidgets][QTabBar] Scrolling with a high resolution mouse wheel changes the current index at a rate more like a normal mouse wheel. Task-number: QTBUG-97844 Pick-to: 6.3 Change-Id: I2e7fd88984a253f6ef8a0008deb7233e4cb4d84a Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* tst_QtJson: fix test for numbers above the limit of qint64Thiago Macieira2022-01-191-10/+7
| | | | | | | | | | | | | Commit 289f909621a8d83320d33e3ff7d651c164034098 ("Test conversion of ulonglong variant to JSON") was trying to ensure the result becomes a double. So there's no reason to make a test in the _data() function. Drive-by fix the UB condition on Windows (ulong is 32-bit, so 1ul << 63 is UB). Change-Id: I0e5f6bec596a4a78bd3bfffd16ca4f8f5219f785 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* tst_QMetaType: remove call to pthread_yield()Thiago Macieira2022-01-191-3/+0
| | | | | | | | | It was Linux-only and now even Linux is complaining: tst_qmetatype.cpp:421:26: warning: ‘int pthread_yield()’ is deprecated: pthread_yield is deprecated, use sched_yield instead [-Wdeprecated-declarations] Change-Id: I0e5f6bec596a4a78bd3bfffd16cb1eadfa301f16 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* tst_QMetaType: remove the IsInitialized checkThiago Macieira2022-01-192-28/+11
| | | | | | | | | All primitive types are initialized and have been since at least commit 33cd680ddbaccf6139e215d851a39e657ae36394 ("New QMetaType representation"). Change-Id: I0e5f6bec596a4a78bd3bfffd16cb1fe22dc5c8f5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* tst_qmetatype: add a few more row for QMetaType::UknknownTypeThiago Macieira2022-01-191-0/+23
| | | | | Change-Id: I0e5f6bec596a4a78bd3bfffd16cb215d7f6c6ddb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* tst_qeventdispatcher: avoid influence between test functionsAlex Trotsenko2022-01-191-0/+8
| | | | | | | | | | | | | | | | | When some test function fails (even as expected), it can leave the event dispatcher in an inconsistent state where the posted events queue might not be empty. As a result, this may break the internal logic of the next test function that is run. So, calling eventDispatcher->processEvents() after each completed function resets the event dispatcher to its initial state, which fixes the problem. Pick-to: 6.2 6.3 Change-Id: I5a54f892d09a6eca73c8fc82875ce3b9ce4a3242 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Win32: always allow the event loop to be woken up by posted eventsVolker Hilsheimer2022-01-191-3/+0
| | | | | | | | | | | | | | | | | | | We set the wakeUps atomic to prevent multiple WM_QT_SENDPOSTEDEVENTS from being posted. However, this might happen right after the event processing thread cleared the atomic, but before it processed the previous WM_QT_SENDPOSTEDEVENTS message. In that case, we end up with a set atomic and an empty event queue, resulting in the event loop to block even though there are posted QEvents. To prevent that, always reset the atomic when we handle the WM_QT_SENDPOSTEDEVENTS message. In that case, we either call sendPostedEvents, or startPostedEventsTimer. The former already resets wakeUps; reset it in the latter as well. Fixes: QTBUG-99323 Pick-to: 6.2 6.3 5.15 Change-Id: I931c02be9c42b02e8ca20daba5059cd8185f0a37 Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
* Add more tests for event dispatcher waking upVolker Hilsheimer2022-01-191-1/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add two tests for some problematic scenarios where the behavior is not consistent across platforms and depending on which event dispatcher is used: 1) reliably waking up the dispatcher when posting events from a worker thread. That test fails 100% of the time on Windows no matter what type of application is created. It passes reliably on Linux and macOS for both core and gui applications. 2) waking up the dispatcher when we post an event from within an event handler. That test fails 100% of the time on Windows, both with core and GUI event dispatchers. On macOS, the test fails 100% of the time with the core dispatcher, and passes 100% of the time with the GUI dispatcher. On Linux, it passes only if a Glib based event dispatcher is used; the default Unix event dispatcher (which is also the one used on macOS for core applications) fails. Task-number: QTBUG-99323 Pick-to: 6.2 6.3 5.15 Change-Id: I2489533b9f0032488707777be0512bb933669a7d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
* Baseline test framework: follow rule of zero for PlatformInfo typeVolker Hilsheimer2022-01-192-29/+1
| | | | | | | | | The compiler generated special functions are just fine. Pick-to: 6.3 6.2 Change-Id: I64fba1fac59f55d2a82ab18e32c1a2b854df72f0 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Baseline test framework: fix bug in internal data structureEirik Aavitsland2022-01-192-23/+2
| | | | | | | | | | | | | | | | | | The 'misc' data field was not copied in the assignment operator. That field is normally not used, so this bug went undiscovered for a long time. But in certain cases, the bug would cause an image size mismatch to be reported as just a normal mismatch. Fix the source of the problem by following the rule of zero - the compiler generated special functions are just fine for this value type. Done-With: Volker Hilsheimer <volker.hilsheimer@qt.io> Pick-to: 6.3 6.2 Change-Id: I8fc8d32d1b83b78cd4ef3f4ec9a8f22661b0e025 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Further improve QShortcut testVolker Hilsheimer2022-01-181-68/+67
| | | | | | | | | | | | | | | | | | Get rid of the function-static main window, which would be destroyed after QApplication if the test is run with a subset of test row (that does not include the TestEnd state test). Make the MainWindow a class member of the test class instead, and rename it from "mainW" to "mainWindow" to avoid shadowing by "mainW" widgets in other test functions. Amends 55928821d1b119112c520af3b83dc9ed210cf5f0. Task-number: QTBUG-99630 Pick-to: 6.2 6.3 Change-Id: I83efce5b54afc3a0027a7c0e63efee6a235af585 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add QDial test in tst_baseline_widgetsAxel Spoerl2022-01-181-0/+41
| | | | | | | Task-number: QTBUG-99712 Pick-to: 6.3 Change-Id: Ib133dd4c1395060be2aac4d3ca1b17eaccc24676 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QMetaType: add a missing check for null d_ptrThiago Macieira2022-01-182-0/+55
| | | | | | | | | | | | | Bug introduced in 6.0. This is the only unprotected d_ptr I could find. [ChangeLog][QtCore][QMetaType] Fixed a bug that would cause QMetaType::compare() and QVariant::compare() to crash on invalid meta types and variants. Pick-to: 6.2 6.3 Fixes: QTBUG-99960 Change-Id: I0e5f6bec596a4a78bd3bfffd16cb1f7b2d146688 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* JSON: When clearing duplicate object entries, also clear containersUlf Hermann2022-01-181-0/+19
| | | | | | | | | | | | | | | | | Previously, if you had multiple entries with the same name in an object, and some of them were again objects or arrays, parsing the JSON document would leak memory. Also, we use std::stable_sort instead of std::sort now, so that we don't accidentally randomize the order of elements with equal keys. [ChangeLog][QtCore][JSON] A memory leak in the JSON parser when reading objects with duplicate keys was fixed. Pick-to: 5.15 6.2 6.3 Fixes: QTBUG-99799 Change-Id: Ic2065f2e490c2d3506a356745542148ad9c24262 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVersionNumber: port fromString() to QAnyStringViewMarc Mutz2022-01-181-0/+41
| | | | | | | | | | | | | | | | | We can handle the UTF-8 case by reinterpreting it as Latin-1. This way, the suffixIndex stays valid as a return value. As a drive-by, optimize away toLatin1() calls by using a QVLA. We really need a better way of converting UTF-16 -> L1 than qt_to_latin1()... [ChangeLog][QtCore][QVersionNumber] fromString() now takes QAnyStringView (was: QString, QStringView, QLatin1String) and a qsizetype pointer (was: int pointer). Change-Id: I86abaadba2792658fbf93ccd1e0b86e3302c697c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVersionNumber: change int to qsizetype in fromString()Thiago Macieira2022-01-171-1/+1
| | | | | | | | | This completes the update to qsizetype in this class, adding a couple of methods that need to be removed in Qt 7. They're only required where int is not qsizetype (i.e., 64-bit platforms). Change-Id: I0e5f6bec596a4a78bd3bfffd16c9de29bec4c637 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QLatin1String: perform the comparison to another QL1S using memcmp()Thiago Macieira2022-01-171-12/+33
| | | | | | | | | | | | | | | | | | qstrncmp() would stop at the first null character, which isn't correct. The tests that had been disabled in tst_qstring.cpp (with an inaccurate comment) were actually passing. I've added one more to ensure that the terminating null is compared where needed. [ChangeLog][QtCore][QLatin1String and QUtf8StringView] Fixed a couple of bugs where two QLatin1Strings or two QUtf8StringViews would stop their comparisons at the first embedded null character, instead of comparing the full string. This issue affected both classes' relational operators (less than, greater than, etc.) and QUtf8StringView's operator== and operator!=. Pick-to: 5.15 6.2 6.3 Change-Id: I0e5f6bec596a4a78bd3bfffd16c90ecea71ea68e Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Remove unused .qrc filesJoerg Bornemann2022-01-1748-757/+0
| | | | | | | | Task-number: QTBUG-94446 Change-Id: I136d8b4ab070a832866aa50b5701fc6bd863df8a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Convert date-time to UTC before claiming it's in GMTEdward Welbourne2022-01-171-8/+26
| | | | | | | | | | | | | | | | | | QNetworkHeadersPrivate::toHttpDate() used a custom format to output a date-time; the format supplied GMT as suffix, but neglected to convert the date-time to UTC, so local-time was formatted as if it were UTC, regardless of its actual offset from it. Fixing this (by the obvious toUTC() call) broke formatting when the supplied header value was a QDate, since it's packaged as a QVariant and QVariant's conversion of QDate to QDateTime uses local time's (not UTC's) start of day. So fix headerValue() to separate QDate and QDateTime cases and use startOfDay(Qt::UTC) to get the right start of the day. Added tests for non-UTC date-times appearing correctly in HTTP headers. Fixes: QTBUG-80666 Pick-to: 6.3 6.2 6.2.3 5.15 Change-Id: I2792bce14a07be025cf551b0594630260c112269 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* widgets baseline test: add QSpinBoxTimur Pocheptsov2022-01-171-0/+37
| | | | | | | | | Very simplistic initial test, inspired by the fix in 'fusion' style, but not style-specific. Pick-to: 6.3 Change-Id: I55ceca7ad214c86cb11032c5342bdae2a83852f1 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Prevent takeStandardSnapshots() from stopping on first mismatchAxel Spoerl2022-01-172-4/+18
| | | | | | | | | | | Force takeStandardSnapshots() to take and log all snapshots before launching QFAIL. Macros QBASELINE_CHECK_DEFERRED and QBASELINE_CHECK_DEFERRED_SUM have been added in qbaselinetest.h Task-number: QTBUG-99790 Pick-to: 6.3 Change-Id: Ia015de808f354e842ac4029c5c84be18c4a4e209 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove execute permission from XML filesEdward Welbourne2022-01-174-0/+0
| | | | | | | | | | | Files that are not meant to be executed should not have the execute permission bit set. Task-number: QTBUG-81503 Pick-to: 6.3 6.2 5.15 Change-Id: I10666bd958adfc5c425216bcff7456facd1fe5f3 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
* QAuthenticator: Use views for arguments in private functionsMårten Nordheim2022-01-171-4/+4
| | | | | | | | | Some lines in tests had to be updated because they lost the implicit conversion from char* to QString. Change-Id: I95af5859ced95b9ca974205398e38c0bd4395652 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fuzzing: Add fuzzer for QJsonDocument::fromJsonRobert Löhning2022-01-172-0/+61
| | | | | | | Task-number: QTBUG-99799 Change-Id: If997b661da2fce04b84f94b9e66de19c9946a914 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QtGui/math3d: Fix QQuaternion::getEulerAngles for GimbalLock casesYuya Nishihara2022-01-161-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is heavily inspired by the patch written by Inho Lee <inho.lee@qt.io>, which says "There is a precision problem in the previous algorithm when checking pitch value. (In the case that the rotation on the X-axis makes Gimbal lock.)" In order to work around the precision problem, this patch does: 1. switch to the algorithm described in the inline comment to make the story simple. 2. forcibly normalize the {x, y, z, w} components to eliminate fractional errors. 3. set threshold to avoid hidden division by cos(pitch) =~ 0. From my testing which compares dot product of the original quaternion and the one recreated from Euler angles, calculation within float range seems okay. (abs(normalize(q_orig) * normalize(q_roundtrip)) >= 0.99999) Many thanks to Inho Lee for the original patch and discussion about rounding errors. Fixes: QTBUG-72103 Pick-to: 6.3 6.2 5.15 Change-Id: I8995e4affe603111ff2303a0dfcbdb0b1ae03f10 Reviewed-by: Yuya Nishihara <yuya@tcha.org> Reviewed-by: Inho Lee <inho.lee@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QCSS: Support Qt 5-style integer property selectorsVolker Hilsheimer2022-01-152-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Qt 5 style sheets, objects could be selected by an enum-type property using the integer value of the enum value, e.g QToolButton[popupMode="1"] { ... } In Qt 6, the the new meta type system and QVariant implementation enabled QVariant::toString to return the string representation of the enum value instead for a property containing an enum. Since QStyleSheetStyle's attribute matching is string based, this breaks the Qt 5 style selector, and QCSS code instead needs to use e.g. QToolButton[popupMode=MenuButtonPopup] { ... } While the new syntax is arguably preferable, this is an unintentional change that silently breaks style sheet code (no error or warning at compile- or run-time). To support Qt 5-style selectors, we have to change the StyleSelector interface of the QCssParser API so that we can pass through what type of value the attribute extractor should return; if an integer string "1" is provided, then we need to compare the enum integer value; if the string provided does not represent a number, then we need to compare the name of the enum value. Since the pure virtual attribute() method that needs to be implemented to extract the attribute value of the node is implemented in modules outside qtbase, add a second virtual method that takes the entire QCss::AttributeSelector, which includes the value to match. Extractor implementations can use it to evaluate which type of data to return for an exact match. The default implementation calls the old attribute() method so that existing StyleSelector implementations continue to work. Make the respective change in the QStyleSheetStyleSelector, and simplify the surrounding code. Adjust other StyleSelector implemnentations in qtbase. As a drive-by, remove the superfluous virtual declaration from those overrides. Once submodules are adjusted to override this virtual function instead of the (now no longer pure) virtual attribute() method, that method can be removed. Pick-to: 6.3 6.2 Fixes: QTBUG-99642 Change-Id: I9a2b3498f77bf7cab5e90980b7dab2f621d3d859 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* tests: port to new QMutableEventPoint static APIMarc Mutz2022-01-153-120/+122
| | | | | | | | | | | | | | | | | | This code didn't actually use QMutableEventPoint::from(), so didn't run into the UB that from() depended on, but it's in the way of making QMutableEventPoint a befriendable namespace instead of a public subclass of QEventPoint. Replaced the QMutableEventPoint ctor that takes a timestamp, and therefore isn't compatible with the ctors on QEventPoint, with a static function that returns QEventPoint instead. Port QList initialization to braced-initialization as a drive-by. Task-number: QTBUG-99615 Pick-to: 6.3 Change-Id: If5a1dbea21cc31cdefdb640716793421c8ec0af4 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add test case for style sheet selectors for enum propertiesVolker Hilsheimer2022-01-151-0/+38
| | | | | | | | | | | | | | | | | | | In Qt 5, such selectors have to use the integer value of the enum value. Using the enum value name does not work. In Qt 6, such selectors must use the enum value by name, using the integer does not work. It's not clear yet what changed, possible a side effect of the changes and improvements in the meta object system and QVariant in Qt 6. So for now, document the difference in behavior in a test. Pick-to: 6.2 6.3 5.15 Task-number: QTBUG-99642 Change-Id: I96e0280b191b8ca06b16a97ab3ed367e9a8f43a0 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>