summaryrefslogtreecommitdiffstats
path: root/tests/auto
Commit message (Collapse)AuthorAgeFilesLines
* JNI: Allow clients to opt into their own exception handlingVolker Hilsheimer2 days3-1/+578
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Detect whether the return type of a call is similar to std::expected. This indicates that the caller wants to handle exceptions explicitly, so in case of error, we pass it through the the std::expected-like value. We still clear the exception state. The caller is responsible for freeing the jthrowable local reference. For this to work, we have to propagate errors through to the outer-most function. This includes allowing QJniObject to create QJniEnvironment instances that don't implicitly return a clean environment in the destructor. As long as we can call checkAndClearExceptions() in the public functions (unless the caller opts in), this should not break any existing code that expects QJniObject to implicitly clear exceptions. Add tests for all overloads to make sure that exceptions (from wrong class or method names, and thrown in methods) are caught. Add "Impl" helpers that do not handle exceptions if instantiated accordingly, and call those if we have to maintain compatibility in public functions while also enabling opt-in handling for modern APIs. Add tests that show that we can now handle exceptions ourselves for all public QJniObject APIs. If possible, we build the test with C++23 so that we can use std::expected; otherwise, try to use tl::expected by downloading the header-only implementation from github; and failing that, use a minimal implementation of a type that could be used instead and makes the test pass. Fixes: QTBUG-93800 Fixes: QTBUG-119791 Task-number: QTBUG-92952 Change-Id: I1cfac37ac9af8fd421bc0af030a1d448dd0e259e Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* tst_QAtomicScopedValueRollback: add a check for atomic<shared_ptr>Marc Mutz2 days1-0/+29
| | | | | | | | | | | | | | | | | Unlike the non-atomic QScopedValueRollback (which has a moveOnly() test to catch such mistakes), QAtomicScopedValueRollback was missing some std::move()s in the implementation. While std::atomic<unique_ptr> is not a thing™, and we thus can't add a moveOnly() check here, atomic<shared_ptr> is, so use that to test. This won't flag missing move()s, because shared_ptr is copyable, but a check of the class for non-trivial payload types was missing, and this adds that. Pick-to: 6.10 6.8 6.5 Change-Id: Ib0ef06be9ef1a6a66564373ff74bdff35dd7b285 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QFlatMap: remove STL-compatibility guard macroMarc Mutz2 days1-1/+0
| | | | | | | | | | The macro has been silently active since 6.5, with no way to disable it, so remove it now, after two LTS releases have been released with this new default. Pick-to: 6.10 Change-Id: Ibc12fa59707a75eb9e4a452471a83e9df206a7b6 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* tst_q23_expected: fix GCC -Wformat-zero-lengthMarc Mutz2 days1-1/+1
| | | | | | | | | | | | | | | | | | | | | | | GCC warns if a format string is statically known to be empty. Since we mark up printf-style QTest::addRow() using the resp. attribute, GCC warns here, too: tst_q23_expected.cpp:23:19: warning: zero-length gnu_printf format string [-Wformat-zero-length] 23 | QTest::addRow("") << false; | ^~ Instead of using the old newRow(), add some content to the data tag instead. It cannot be left unmentioned that this test doesn't test ... very much. I hope we don't use this component in production code, yet... Amends 4e9f4d5d02e29b4522540b8f9b9b01b7e57a6b54. Pick-to: 6.10 Change-Id: I50ebb074997e034506c6602ff7602ad392b745be Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Tim Blechmann <tim.blechmann@qt.io>
* wasm: Refactor PromiseEven Oscar Andersen2 days3-0/+550
| | | | | | | | | | | | | | | | | | | | | | | | Switch from a function based implementation to making Promise a object. Maps straightforward to a javascript promise, except for this: We need to do cleanup when the promise has been fully processed. We do this by adding a final handler. However, the handlers are called in the order they are added, so the final handler we add in the constructor will be executed too early. We solve this, in a non optimal way, by adding a final handler after each then, and catch, handler. This makes the interface easy to use, even if it is suboptimal Fixes: QTBUG-142138 Change-Id: I6be3f102e838467cc98f4a9825fd5f6fe0e1e1a2 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* tst_QString: make an array constexpr and init from char16_tMarc Mutz3 days1-1/+1
| | | | | | | | | | | | | | | | | This re-applies to dev the relevant changes from the 6.5/6.8 picks of 7bf27b88eafbc54762cdeb28c9202bb7e080b308, which this patch amends. In those older branches, fromRawData() wasn't overloaded for char16_t, yet, and, changing to use a QChar array instead, I had to change the initializer to char16_t literals and added constexpr to guaranteee constant-initialization. Since these changes are already in 6.5 and 6.8, it suffices to pick to 6.10. Pick-to: 6.10 Change-Id: Ib5da4c7a61c34d1db7be8f8fb4c6e197d4fc42fe Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* CMake: Allow adding tools dependencies on INTERFACE librariesAlexandru Croitor3 days5-1/+38
| | | | | | | | | | | | | | | | Rename the QT_EXTRA_TOOLS_PACKAGE_DEPENDENCIES property to _qt_extra_tools_package_dependencies so we can set it also on INTERFACE libraries with older CMake versions. Remove the check for is_interface_lib in qt_internal_create_module_depends_file so we can add tool package dependencies with qt_record_extra_qt_main_tools_package_dependency on INTERFACE libraries as well. Use the new feature in the StandaloneToolsPackage RunCMake test. Change-Id: Ia36acf785f5f8512580dfcd3e599a5e704f9422e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Allow creating a standalone Tools package without a moduleAlexandru Croitor3 days8-0/+110
| | | | | | | | | | | | | | | | | Add a new qt_internal_add_tools_package function to allow creating a standalone Tools cmake package. It can be useful for a repo which might build e.g. an arch-independent java tool exposed by an IMPORTED executable, but has no associated C++ Qt module. Also add a qt_internal_record_tools_package_extra_third_party_dependency function to allow looking up additional third party cmake packages when finding the tool package. Change-Id: I46f5fb9f7a361ecf4018f0fc1ed0a1f8ecf12df3 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Revise comment on recently-changed test-caseEdward Welbourne3 days1-1/+1
| | | | | | | | | | | | | | | Amends commit 3a711ad61926adfc3a57adf9fd83588efdf20b28 - CLDR v48 update. That changed a test-case to use an apostrophe in place of a right single quote as the grouping character for Swiss German (which thus now matches C++). I forgot the change the related comment on the test-case at the same time, leaving it still claiming right single quote. Updated now. Thanks to Sune Vuorela for spotting the omission. Test is new in dev so no need to pick back to older branches. Task-number: QTBUG-141949 Change-Id: I599bc8c9a302891a739ee247e675f899302e742a Reviewed-by: Mate Barany <mate.barany@qt.io>
* QImage: Don't truncate 16Bit PGM image data to 8BitWladimir Leuschner4 days2-0/+261
| | | | | | | | | | Currently 16Bit PGM images are truncated to 8Bit data, which loses precision. This patch checks if the ppm data is 16Bit and stores the image data into a QImage with format QImage::Format_Grayscale16 Fixes: QTBUG-141995 Change-Id: Icfa0c4f59982c414195f64bf1f4a768b26f414a6 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QMetaContainer: Optimize iterator comparison a bitUlf Hermann4 days1-0/+21
| | | | | | | | | | | If the iterator pointers are the same, then the iterators are the same and their distance is 0. No need to call any functions for this. This also makes empty container interfaces less dangerous. The resulting containers are simply empty, too. Change-Id: I64896fdaa391e97e46430233a74071aadf20f0ea Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QHttp2Connection GOAWAY overhaulMårten Nordheim4 days1-0/+110
| | | | | | | | | | | | | | | | | | | | | | | | While trying to figure out what the problem may be in the linked bug report, it became visible that the GOAWAY parts likely haven't been exercised very well. For one, we are supposed to ignore incoming streams beyond what we told the peer was the last stream to be processed. But we also need to process certain frames, like DATA and frames carrying HEADER content, because they affect state for the entire connection, state that the peer cannot roll back on their side. There were also some bugs in our handling of a GOAWAY frame, such as always assuming it was a client on the receiving end and, following on from that, some issues with notifying streams that they have received a GOAWAY. Task-number: QTBUG-139692 Task-number: QTBUG-135049 Pick-to: 6.10 6.8 Change-Id: I0bc1f51787b7a9df81a6a9b855a390c8f8b30e5b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
* Blacklist a few tests for macOS 26 due to wrong mouse pos on enter eventTor Arne Vestbø4 days2-0/+4
| | | | | | | Pick-to: 6.10 6.8 6.5 Task-number: QTBUG-142157 Change-Id: Ibf17be36062644d8410d7652301ecdffa80ea3f0 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_Moc: port relatedMetaObjects{WithinNamespaces,NameConflicts}() away from ↵Marc Mutz5 days3-4/+4
| | | | | | | | | | | | | | | | Q_ENUMS Like relatedMetaObjectsInGadget() in a previous commit, these tests doesn't specifically check Q_ENUMS, but e.g. the use of another QObject's enum in a class not derived from the the first QObject. So port from Q_ENUMS to Q_ENUM, in order to help with the Q_ENUMS deprecation effort. Task-number: QTBUG-99060 Pick-to: 6.10 6.8 6.5 Change-Id: Ibdb58df188ab2fcbb15f3d1d13998e271180b564 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* Blacklist tst_qguieventdispatcher::postEventFromThread on macOS 26Tor Arne Vestbø5 days1-0/+2
| | | | | | | | | It's flakey and failing often. Task-number: QTBUG-142185 Pick-to: 6.10 6.8 6.5 Change-Id: I5779e01c64203011786f4466b130f4884ea19858 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Android: expect fail for tst_Android::testFullScreenDimensions cases for ↵Assam Boudjelthia5 days1-5/+6
| | | | | | | | | Android 16 Amends 422ecf55309c833477f92f3392e17aed46dd6c29. Change-Id: I996321d7e5eb4f5eaabd114d2d6df62c4ae42711 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* tst_Moc: port relatedMetaObjectsInGadget() away from Q_ENUMSMarc Mutz5 days2-2/+2
| | | | | | | | | | | | | | This test doesn't specifically check Q_ENUMS, but the use of another Q_GADGET's enum in a class not derived from the the first Q_GADGET. So port from Q_ENUMS to Q_ENUM, in order to help with the Q_ENUMS deprecation effort. Task-number: QTBUG-99060 Pick-to: 6.10 6.8 6.5 Change-Id: I4363a05fe6d3ce4e825599151dc6626b8ef2b388 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* tst_QMetaObjectBuilder: complete port away from Q_(ENUM|FLAG)SMarc Mutz5 days1-4/+2
| | | | | | | | | | | | | ... to Q_(ENUM|FLAG). Amends 0e7de25c525fabb4df7cafb8825e65522c476752, which added the Q_ENUM w/o removing the Q_ENUMS, and forgot the Q_FLAGS port to Q_FLAG. Task-number: QTBUG-99060 Change-Id: I7ab645165a2611c156d0b94f9ea59fb6d98f55a3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QTabBar: Emit tabCloseRequested on middle click if tabsClosableXavier BESSON5 days1-1/+24
| | | | | | | | | | [ChangeLog][QtWidgets] Middle clicking tabs in QTabBar with tabsClosable set to true will now emit tabCloseRequested. Fixes: QTBUG-141519 Change-Id: I101e599b95683e5de4e951f7da3ae31264caa24c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* QTextDocument: fix repeated calls of unit testsTim Blechmann6 days1-0/+2
| | | | | | | | | | | | Tests may set the default resource provider. Calling the test multiple times results in a heap-use-after-free error/crash. So we need to unset the default resource provider. Amends ccf1a1a9536be7b904494f5b3243202d71a33b06. Pick-to: 6.10 Change-Id: I6bc1d67af54534e85fe95dc57236499bc2e7b923 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Include font features in QFont::toString()Vlad Zahorodnii9 days2-24/+90
| | | | | | | | | | | | | | | | | This ensures that font features, for example calt or liga, can be saved in QSettings using QFont::toString() and QFont::fromSettings() as expected. With the proposed change, QFont::toString() will append the number of font features followed by a list of key=value pairs specifying feature settings. The corresponding tests have been reworked a little bit because following the established patterns was slightly challenging. Task-number: QTBUG-141412 Change-Id: I7a80d5fe1d120b514797bfb515c3a6b0867a6ee5 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QTableView: correct selection with moved columns/rows and spansChristian Ehrlicher10 days1-0/+46
| | | | | | | | | | | | When a column or row is moved and there are spans, the calculation of the correct row was not correct for the 'moved to' column/row because there was a mixup of visual and logical columns. Pick-to: 6.10 6.8 Fixes: QTBUG-138513 Change-Id: Ia3d1aa2c5376cb25ea56dc55b6a57a88edbfec30 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* forkfd: configure our signal handler to restart the syscallThiago Macieira10 days5-0/+141
| | | | | | | | | | | | | | | | | | | | | | | | This should help solve problems with other libraries that don't have proper EINTR_LOOP around their operations. Like most of <stdio.h> and thus <iostreams>. This change does not affect FreeBSD or Linux, where we don't install a signal handler in the first place. And obviously, it will have no effect if something else overrides our signal handler without this flag. If that happens, please complain to the piece of software that forgot the flag. This test has also revealed that Windows presents a similar wake up: if the grandchild process shares the child's stdin (which happens by default for startDetached()) the child gets woken up from WaitForSingleObject() when the grandchild dies and thus fgets() returns error. That has nothing to do with QProcess, and AFAICT is simply the way pipes work on Windows. Fixes: QTBUG-142041 Pick-to: 6.10 6.8 6.5 Change-Id: I5900f238ec4a85ed49affffd29fc4248cc272929 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix QTZLocale's parsing of non-BMP digitsEdward Welbourne10 days1-0/+3
| | | | | | | | | | | | Digit-parsing wasn't taking into account the width of digits. It thus failed where digits are encoded as surrogate pairs. Expanded a test to expose this failure. Take the width of digits into account. Pick-to: 6.10 Task-number: QTBUG-139223 Change-Id: I0e5497203d6657d04878f06b6a736a57c16edc2f Reviewed-by: Mate Barany <mate.barany@qt.io>
* Build with QT_NO_URL_CAST_FROM_STRINGAhmad Samir11 days2-6/+9
| | | | | | | | | | | Can't mark the whole repo with that macro, because in corelib that would take out the QString conversion operator which is BiC. Add a hard build-time error if QT_NO_URL_CAST_FROM_STRING is defined in corelib, as requested in code review. Change-Id: Ia0e302a2f82b86800e84d15e86ab138f78d45e4d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use Q_ENUM/Q_FLAG instead of Q_ENUMS/Q_FLAGSAhmad Samir11 days2-1/+3
| | | | | | | | | Q_ENUMS and Q_FLAGS have been deprecated since at least Qt 6.0. Task-number: QTBUG-99060 Change-Id: Ia8cbc607c34683dec99587571c0d04f1854e77c2 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_QSslKey: do not use EVP_PKEY_cmp on ML keysTimur Pocheptsov11 days1-1/+4
| | | | | | | | | | | | | We do not setup pkey for QSsl::MlDsa, and as a result EVP_PKEY_cmp, starting from OpenSSL 3.5 is failing (retuns -2), essentially trying to compare an empty EVP_PKEY with something we read from a pem file. Previously we did not test those mldsa keys, thus the problem went unnoticed. Change-Id: Icfa8ab7b703e1f5ae10d91bcaf37f5772b7eacdd Pick-to: 6.10 Fixes: QTBUG-141723 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* tst_http2: Drop 100ms cutoff for server startupMårten Nordheim11 days1-1/+1
| | | | | | | | | | The event loop already exits early when the server starts, the 100ms just causes flakiness. Pick-to: 6.10 6.8 6.5 Change-Id: Iea43f0f54dad95b6fb09ced12f9fd16a3b786939 Reviewed-by: Mate Barany <mate.barany@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QArrayDataOps: allow truncate(samesize)Thiago Macieira12 days2-0/+18
| | | | | | | | | | | | | | | | | | There's no reason to disallow truncating nothing. The alternative is to check the size before truncating, which is unnecessary extra branching. Instead, just let this function do nothing. Amends 15e3ae6b9da9b32236d3e3348ede86c3acf06fb4 ("Introduce QArrayDataOps::truncate") from Qt 5.0 but cherry-picking nowhere near as far back because nothing used it until assign() in Qt 6.8. QList does not have a truncate() function and both QString's and QByteArray's use resize() instead. Pick-to: 6.10 6.8 Fixes: QTBUG-141918 Change-Id: Ie3342e0ea9ee312bd5cbfffd4d4a83da27a838e6 Reviewed-by: Sune Vuorela <sune@vuorela.dk> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QArrayDataOps: reactivate arrayOpsExtra testThiago Macieira12 days1-20/+50
| | | | | | | | | | Amends commit b99271caa6231ad753bc796dae5202ebc1cb9440, which added the temporary QSKIP but forgot to remove. Pick-to: 6.10 6.8 6.5 Change-Id: I7d7a2658f607fe28d9a9fffd9ba5bd55fdc2f839 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* tst_QVariant: add a test to ensure relocatability changes do workThiago Macieira12 days4-1/+193
| | | | | | | | I'm not sure how far back this works. Pick-to: 6.10 Change-Id: I728eaee3841aefe5da39fffda6a8e1be0ff682cb Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Fix handling of non-BMP digits in milliseconds fields of timesEdward Welbourne12 days1-0/+7
| | | | | | | | | | | | | | | The code to trim trailing zeros from z (or zz, but not zzz) format correctly checked for whether the text ended with the locale's zero, but incorrectly chop(1)ed to remove the zero, neglecting the possibility that the zero is longer. Noticed while checking where else we used QLocale::zeroDigit() possibly naively. Add Fulah-Adlam tests for milliseconds, which confirmed the problem does actually appear. Fix dropping of trailing zeros from millis. Pick-to: 6.10 6.8 6.5 Change-Id: Id080f082b2890a102809ba8d0f687d55ac082357 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSslSocket::ephemeralServerKey - don't expect a specific ciphersuiteTimur Pocheptsov13 days1-0/+3
| | | | | | | | | | | To be negotiated during TLS handshake, as of OpenSSL v 3.5 despite requested specific ciphersuite, the one that is negotiated is different and thus test's expectation are failing in QVERIFY. Fixes: QTBUG-141722 Pick-to: 6.10 Change-Id: I3a000fc82692224b77edd48ee39bbcdb43e114c8 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Update CLDR to v48Edward Welbourne13 days2-2/+2
| | | | | | | | | | | | | This is just the plain upgrade without adding new languages. It required two changes to expected data in tests. [ChangeLog][QtCore][Third-Party Code] QLocale now uses v48 of the Unicode Consortium's Common Locale Data Repository (CLDR). Pick-to: 6.10 6.8 6.5 Task-number: QTBUG-141949 Change-Id: I8d3a299c602e6cd5ea76c6bc479028aeda8b8e50 Reviewed-by: Mate Barany <mate.barany@qt.io>
* Add binary compatibility file for 6.10Johanna Äijälä14 days1-0/+31363
| | | | | | | Task-number: QTBUG-140614 Pick-to: 6.10 Change-Id: I05d66682a13321135d741808dab05cdb8ff6f6c1 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* tst_QString: add some tests for utf16()Ahmad Samir2025-11-161-0/+23
| | | | | | Pick-to: 6.10 5.8 6.5 Change-Id: Id9d4e8fd11b85fda1a694f28f52d1e9bbd43bce8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRM: report the number of properties as column count in trees of gadgetsVolker Hilsheimer2025-11-142-0/+37
| | | | | | | | | | | | | | | | | | Instead of hardcoding the column count to 1 for one-dimensional ranges, use the row traits's fixed_size attribute, which reports the number of properties for rows that are gadgets. This was already correctly done for tables. To remove duplication, move the structure-independent part of the logic into a reusable helper in the base class. Add basic test coverage. Fixes: QTBUG-141885 Pick-to: 6.10 Change-Id: Ic10a8a61998184485acb89ca9db0d9c9be822f2d Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* tst_qdbuscpp2xml: replace Q_ENUMS with Q_ENUMAhmad Samir2025-11-131-1/+1
| | | | | | | | | | | | | This doesn't affect the test itself, see qdbuscpp2xml_data(). This tests revolves around the flags from the `QDBusConnection::RegisterOption` enum, so Q_INVOKABLE, Q_SCRIPTABLE, Q_PROPERTY, signals and slots. Q_ENUMS has been deprecated since at least Qt6.0. Pick-to: 6.10 6.8 6.5 Change-Id: I8232641337b5823c9951d00fcfae9c7a3b25ed88 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Tidy tst_LargeFile: split two long lines, purge a spurious blank lineEdward Welbourne2025-11-131-5/+8
| | | | | Change-Id: I765c8ce00d980ca257b00b328bfb8d08f8f56324 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Modernize tst_LargeFile: replace an enum with constexpr named valuesEdward Welbourne2025-11-131-12/+10
| | | | | | | | One member of the enum was a bool, the other an int; make that explicit by converting each to a constexpr of its type. Change-Id: I5a36a811feae7b23a363d091f0bf6a89cb312d74 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Use a scope guard to manage output previously routed via QVERIFY(false)Edward Welbourne2025-11-131-4/+9
| | | | | | | | | | | A test that QCOMPARE() didn't quite match did its own comparison using std::equal(), produced its own custom output and used QVEIRFY(false) where it could have used QFAIL() but had nothing more to say. Replace with a scope-guard to handle the custom output and simply QVERIFY() the std::equal() check, so that check will in fact show up in output. Change-Id: I1dfe233b0b69c507927f22d7fdb45af227824b43 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Modernize tst_LargeFile: use NSDMI for construction where possibleEdward Welbourne2025-11-131-32/+32
| | | | | | | | | | | | | | | | | | The QEMU special case only affected the QT_LARGEFILE_SUPPORT branch of the cascade of #if-ery on maxSizeBits, which can thus be constexpr in all other cases and const even in that case. Also record why it's limited to 28 rather than the 31 implied by the prior comment (previously only otherwise discoverable in git history). Mediate the complex #if-ery for the initial value of maxSizeBits by introducing a constexpr maxAllowedSizeBits set within such #if-ery, so as to simplify setting maxSizeBits itself. Note that this member is in fact varied by some tests, implying order-dependence. Move the member constants to before the constructor to make it possible to have a define that correctly controls inclusion of the QEMU tweak. Change-Id: Id6f8d55a34431d8f08f0e2b346c826bb49991423 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QRandomGenerator: remove direct use of HW instructionsThiago Macieira2025-11-121-15/+9
| | | | | | | | | | | | | | | | | | | | | The HWRNG instructions are not necessarily faster than what we can get from the OS. Moreover, the OS is able to collect entropy from sources other than the CPU itself. More importantly, this removes the need for Qt to deal with broken HWRNG, passing the buck to the OS (which may disable the CPUID bit, causing the application to fail to load). [ChangeLog][QtCore][QRandomGenerator] This class no longer directly uses a hardware random number generator on x86 systems, even if one is available. Instead, it will always use a generator provided by the OS (so performance will be OS-specific), though there should be no meaningful difference in the quality of the samples generated. Task-number: QTBUG-69423 Task-number: QTBUG-129193 Pick-to: 6.10 6.8 6.5 Change-Id: I5121c5a34d684983fa1dfffdbabd22de51966650 Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Remove QSKIP wayland tst_QGraphicsPixMapItem as no longer failingFrédéric Lefebvre2025-11-121-3/+0
| | | | | | | | Remove a QSKIP that was previously used in tst_QGraphicsPixItem on wayland as it is no longer failing consistently. Change-Id: I3b918fc3a9e2fa3b38dd0172e240774f04b07aee Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QRangeModel: implement autoConnectPolicyVolker Hilsheimer2025-11-122-5/+251
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A model that operates on a range holding items of the same QObject subclass presents the values of the properties of those QObject instances as its data. The property names will be used as the role names. It is then very convenient if changes to the properties in those QObject instances makes the model emit dataChanged() for the respective index and role. This requires that we identify the changed-signals for each property that corresponds to a role name, and connect to each of those signals for each object instance. This is an expensive operation, in particular for trees where we have to recursively traverse the entire sturcture. But a range holding QObjects is already quite expensive and therefore only reasonable for small models with dozens rather than thousands of items. At that scale, the overhead is acceptable, and we can store the respective meta data in a baseclass of our storage type, specialized for when the range's item type is the same QObject subclass for all columns. We know this already, as the default implementation of roleNames() uses that as well. Each connection goes to a functor object that stores the index and the role, which is the information we need to emit dataChanged. By storing the index as a QPersistentModelIndex, objects changing position in the model will automatically update the functor object. The public API for this is a policy property, with two values (plus the "None" default value): a Full auto connect iterates the entire model and connects all relevant properties. This is expensive compared to only connecting some objects and properties, but gives full coverage, and has no overhead other than the connection itself. The alternative is OnRead, which connects lazily when data is read for the first time. This is cheaper if it's unlikely that all objects and/or all properties are displayed, but adds book-keeping overhead so that we know when an object and role are already connected. If everything gets connected lazily, then this is substantially more expensive than doing a full auto-connect in the first place. When new rows or columns got inserted, and if autoConnectionPolicy is set to Full, then we need to connect the new objects after QAIM emitted rows/columnsInserted(). This gives clients a chance to populate the new cells with objects. When rows or columns are removed and the policy is set to OnRead, then we have to remove those connections from our book- keeping set. When objects are removed from the model (which means rows or columns are removed), then we need to break the connection to the respective objects. As the QObjects will likely be destroyed anyway, which will then break the connections, we disconnect lazily: we disconnect if our functor gets called for an object that has been removed. In that case, the stored QPMI will have become invalid. To break the connection, we need to store the QMetaObject::Connection in the functor object. However, we only get that connection handle as a result of making the connection, at which point our functor object has already been moved into Qt's QCallableObject data structure. In order to store the connection handle, we implement the move constructor of the functor to store the address of the move-constructed functor object in the moved-from functor object. This makes a moved-from functor act as a reference to the moved-to functor and we can use that to store the connection handle in the functor instance that is stored in the QCallableObject. Since a functor instance holds either the property data, or the address of the moved-to instance, we can use a std::variant to avoid overhead. Using a plain union would be even cheaper, but at this point, benefit from the guard-rails we get from std::variant. The context object for all connections is then a dedicated QObject, which we can simply delete to break all connections. [ChangeLog][Core][QRangeModel] A range model operating on a range that holds identical QObject sublasses for all items can now automatically connect the changed signals of all properties mapped to item roles to the model's corresponding dataChanged signal. This allows user code to change properties of the item-object directly, and model clients (like item views) will get updated. Change-Id: I742b57f0c90f705d8b7eb949ff0d026b8b4a52f3 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Add both required binaries to the android buildLauri Pohjanheimo2025-11-111-3/+4
| | | | | | | | | Now both modal_helper and desktopsettingsaware_helper binaries are included into the Android apk package. Task-number: QTQAINFRA-6891 Change-Id: I451a2fa6d2424f838e9d60b5908f4c9ce4c51e42 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* tst_QMetaObject: fix regex used in QTest::ignoreMessage()Ahmad Samir2025-11-091-14/+12
| | | | | | | | | | | | | '|' is a special character in a regex pattern, so it should be escaped. Amends e90705687f5faba41d9a8544c875d8c6b1cedbdc. Drive by, it's cheaper to reuse QRegularExpressionS (one state machine transformation per pattern). Pick-to: 6.10 6.8 Change-Id: I185953224aed7eadf73dd26f4d5e3c01f8a73ebe Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_QSettings: split the testEscapes() test, testBadEscapeAhmad Samir2025-11-091-23/+31
| | | | | | | | | | | | Making it easier to debug. Use example.org instead of software.org, the latter is regitered and we shouldn't use it in tests. Pick-to: 6.10 6.8 6.5 Change-Id: I83cefa2eaffa86ccbaa237feeaaf4f54eab857c6 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_QSettings: split the testEscapes() test: testEscapedVariantAhmad Samir2025-11-091-20/+39
| | | | | | | | | | | | | | | | | Making it easier to debug. The original code explicitly compared the input QVariant with the variant-converted-to-the-underlying-type, most likely to test the conversion round-trip. This is already covered by QSettingsPrivate::{variantToString,stringToVariant}() which does the conversion internally. Use example.org instead of software.org, the latter is regitered and we shouldn't use it in tests. Pick-to: 6.10 6.8 6.5 Change-Id: Ic866f39af50370079bcfefc24c9093d733e32f9e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Android: expect testFullScreenDimensions on Android 16 to fail in CIRami Potinkara2025-11-081-2/+7
| | | | | | | | | | | | | | This patch changes expectation for one condition in CI to fail. Test or implementation needs later to be fixed, or test to be removed. Also the edge-to-edge support should be changed later to work in similarly at locally and at CI. Change is only done to dev, as similar fail has not seen in 6.10. Task-number: QTBUG-141712 Change-Id: I42452bdda0baa2b32d83b6f858b96cadb6c2f52e Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>