aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrolstestutils
Commit message (Collapse)AuthorAgeFilesLines
* Run tst_qquickfiledialogimpl also with the Imagine styleOliver Eftevaag2025-10-241-1/+1
| | | | | | | | | | | The intention was always to run it with every single built-in style. Previously the Imagine style was omitted because of an issue that needed more investigation. It seems like that has since been resolved, and that it's safe to include it in the list of styles to run tst_qquickfiledialogimpl with. Change-Id: I7634a938c550392f8f5c18c141404c80a7ab99b2 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QuickStylePlugin::unregisterTypes(): cleanup selectors from global listOliver Eftevaag2025-10-061-0/+5
| | | | | | | | | | | | | | | | | | | | | | | File selectors may have been added in QQuickStylePlugin::registerTypes(). It makes sense to clean them up when a style plugin in unloaded, otherwise the first style that was loaded will always be prioritized, even if it was unloaded later on, during runtime. This change causes tst_qquickfiledialogimpl to acutally run with all styles (except Imagine). Originally I thought da777a75f65ad101e9b0bad7c098004c0a699b41 would work by itself, but it turns out that the test would run 4 times with the same style (Basic), instead of the intended Basic, Fusion, Material and Universal styles. By cleaning up old selectors, the test will now finally run will all the different styles. This caused some of the test functions to break. The Material style is infamous for having transitions for opening and closing popups. There were a few other functions too that broke for other reasons. Fixes for those functions are also included in this patch. Change-Id: I3c350b5e72454fccedbc2579db4813d953dfbb95 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Run tst_qquickfiledialogimpl tests for multiple dialog stylesOliver Eftevaag2025-08-272-0/+38
| | | | | | | | | | | | | | | | | | | | | We were only testing the non-native file dialog under the Basic style previously, but we have 4 other styles (Fusion, Imagine, Material, Universal) that were never tested. This unfortunately caused recent regressions in both the FileDialog and FolderDialog. By running each test once for more styles, we should be better protected against future regressions in individual styles. In this patch, we enable all tests for Basic, Fusion, Material and Universal. The Imagine style is intentionally omitted due to a bug, which causes the tst_qquickfiledialogimpl::defaults() test to fail. This will be fixed later. Change-Id: I9b4ab722c5ad3052122024ad3a7a2f0a99de77e6 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Move qActiveFocusFailureMessage into a Private namespaceMitch Curtis2025-07-122-2/+4
| | | | | | | | | | | | | | Addresses header review feedback: https://codereview.qt-project.org/c/qt/qtdeclarative/+/651782/1/src/qmltest/quicktest.h#86 Amends 386e0851146bdfb24ad841ac388745c3af802673. Task-number: QTBUG-137478 Pick-to: 6.10 Change-Id: Ie16fcac17b29280e47ef9e4362b877f3b4c61b74 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QQuickTest: return QByteArray from qActiveFocusFailureMessage helperVolker Hilsheimer2025-06-302-3/+3
| | | | | | | | | | | | | | The primary use case for this function is to print diagnostics in case of test failure, so don't go through from UTF8 to QString and back, and instead return a QByteArray directly. Amends 386e0851146bdfb24ad841ac388745c3af802673 to address header review comment. Pick-to: 6.10 Task-number: QTBUG-137478 Change-Id: Id5e242be274ef173bc89e281e6e6db5ce758914c Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* MonthGrid: fix dates being incorrect for certain timezonesMitch Curtis2025-06-302-0/+26
| | | | | | | | | | | | | | | | | | | | | | When a QDate is passed to QML, it becomes to a JavaScript Date. As Dates are stored in local time, the QDates we were passing to QML had the potential to be one day off in certain timezones. For example: 00:00 UTC converted to UTC-8 is 20:00 the day before. Fix this by storing and providing dates as QDateTime so that we can give it a time of day that can't possibly result in a different day when converted to local time. It's fine to change the C++ API since it's private, and nothing will change for the type that users see, since they always get a Date. Add a SystemEnvironment singleton to QQuickControlsTestUtils (Qt.test.controls) to allow reading and writing environment variables from QML. Fixes: QTBUG-72208 Pick-to: 6.8 6.9 6.10 Change-Id: Idb4ab26568d8f1eddd5ab4cebe691e38173d02a9 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* tst_QQuickFile/FolderDialogImpl: use canonical pathsMitch Curtis2025-06-112-5/+5
| | | | | | | | | | | | | | | | | This adapts to 7bd7df5aa170c240061144a9210a13b62949935c. The test was expecting e.g. this path: /var/folders/0r/vd385j117f949qnfm4h_539w0000gn/T/tst_qquickfiledialogimpl-dqvSBE/sub-dir But the actual path was this: /private/var/folders/0r/vd385j117f949qnfm4h_539w0000gn/T/tst_qquickfiledialogimpl-dqvSBE/sub-dir Fixes: QTBUG-137416 Pick-to: 6.5 6.8 6.9 6.10 Change-Id: I31b929017ebb1a672a614f8b409dc5c4e8d5e000 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQuickTest: add and use active focus macrosMitch Curtis2025-04-252-0/+19
| | | | | | | | | | | | | Also add support for popups (when controlstestutils_p.h is included). [ChangeLog][Qt Quick Test] Added QVERIFY_ACTIVE_FOCUS and QTRY_VERIFY_ACTIVE_FOCUS macros that can be used to get detailed failure messages for when QQuickItem::hasActiveFocus should be true but isn't. Task-number: QTBUG-133858 Change-Id: I30c67a84ccc16e3969bac5661648d0062bc3d62c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Correct drapanddrop arguments for conditional compilationSanthosh Kumar2025-04-141-3/+3
| | | | | | | | | Amends patch: b4ed50f0090c3cec8e74b99b3a35c6266e6dc2ec Pick-to: 6.9 6.8 Change-Id: I1a9f05031251fc5221e175f064e6c962f713c797 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* Avoid QWindowSystemInterfacePrivate use in QQuickControlsTestUtilsTor Arne Vestbø2025-04-101-2/+1
| | | | | | | | | | | | | | | | | QWindowSystemInterfacePrivate is (as the name implies) a private implementation detail of QWindowSystemInterface and shouldn't be used by classes like QQuickControlsTestUtils. Doing so was causing build issues after internal refactorings of QWindowSystemInterfacePrivate. Amends b45629207ee32a3d80b6ea6553e8762eec8a86da. Pick-to: 6.9 6.8 Change-Id: Ia2a52e3592d2655b8c081063cfdfa94577d79373 Reviewed-by: MohammadHossein Qanbari <mohammad.qanbari@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix compilation when draganddrop support is disabledJuha Vuolle2025-04-101-3/+3
| | | | | | | | | | | | | | | | | | | | When Qt is configured with -no-feature-draganddrop, the quick_draganddrop feature gets disabled too. Consequently many dialog files are then omitted from the build, see src/quickdialogs/quickdialogsquickimpl/CMakeLists.txt. As a result, some dialogs and templates that include and use these files/classes unconditionally, fail to compile. This commit adds same feature guards to these includes/uses. In addition this commit adds the few missing 'drag' feature guards in QQuickVerticalHeaderView as well as adds appropriate feature guards to autotests. Pick-to: 6.9 6.8 Fixes: QTBUG-135740 Change-Id: If1688a3cd8f52918088a8c586d54ccf09cb08890 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Add arePopupWindowsSupported function to QQuickControlsTestUtilsMitch Curtis2025-04-092-0/+11
| | | | | | | | And reduce a few duplicate checks throughout our tests. Pick-to: 6.8 6.9 Change-Id: I31610f07eb548282ade5573af56ffef18d33cd66 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Material: Fix running test_systemTheme with actual Dark system themeJarkko Koivikko2025-02-251-1/+1
| | | | | | | | | | | | | | | MockPlatformTheme::m_colorScheme was initialized to Unknown, which translated to System theme, which was handled as not Dark theme in the test case. This worked, if the actual system theme was Light. However, when the system theme is Dark, QGuiApplication::styleHints colorScheme is initialized to Dark as well. In this case, the test case failed, because the styleHints did not change and the Material style did not receive theme change event, resulting in test failure. Pick-to: 6.9 Change-Id: If9bd4a942344b19dffe2b3ffb96faf0c18b9e2b0 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickControlsTestUtils: add VERIFY_VISUAL_FOCUS and use itMitch Curtis2025-02-242-0/+22
| | | | | | | | | | | | | | | | Adds useful information to diagnose the cause of active focus failures. The failure message will now look like this: FAIL! : tst_QQuickMenu::FluentWinUI3::contextMenuKeyboard(Popup.Window) 'firstItem->hasVisualFocus()' returned FALSE. (control: MenuItem_QMLTYPE_1545(0x5db854767310, name="firstMenuItem", parent=0x5db8549a28d0, geometry=0,0 190x30, z=1) activeFocus: true focusReason: Qt::OtherFocusReason activeFocusItem: "MenuItem_QMLTYPE_1545(0x5db854767310, name=\"firstMenuItem\", parent=0x5db8549a28d0, geometry=0,0 190x30, z=1)") We add both a function and a macro, as this allows the helper to be stepped into while debugging. Task-number: QTBUG-133858 Pick-to: 6.8 6.9 Change-Id: I26014ee93f5f053df1ac19ac6e673876abce1258 Reviewed-by: Doris Verria <doris.verria@qt.io>
* Universal: update style theme when system theme is changedMitch Curtis2024-09-201-0/+18
| | | | | | | | | | Does what b45629207ee32a3d80b6ea6553e8762eec8a86da did with the Material style with the Universal style. Fixes: QTBUG-128444 Pick-to: 6.8 Change-Id: I7bb10f2852f91d2c4a21dc30170220e1528387be Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* Enable popup windows for QtQuick.DialogsOliver Eftevaag2024-07-231-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | The dialogs in QtQuick.Dialogs look so much better on desktop systems, when they appear inside real top level windows. This change enables the feature for all QtQuick.Dialogs types, and makes manual changes to each dialog, to make sure that they look good. This includes changes that hides the title from the header, since the title can now appear inside the window decoration instead. Lots of tests had to be changed, as a result, to properly generate and deliver events to the correct items. In addition, I've added some helper functions to dialogHelper, to handle cases we're we need to wait for a popup window to appear. Showing popups with dedicated windows, takes longer than simply creating a new item in an existing window. [ChangeLog] All dialogs in QtQuick.Dialogs will now use popup windows, if able. Fixes: QTBUG-126006 Pick-to: 6.8 Change-Id: Ieca6ae643d4f97b1bed648e448bbcd236a50e7e7 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* CMake: Annotate some targets with SBOM informationAlexandru Croitor2024-07-111-0/+1
| | | | | | | Pick-to: 6.8 Task-number: QTBUG-122899 Change-Id: I10e2fa8827ad848e7ed93baa7ea3ae0961b9010d Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Correct license for Qt Test library filesLucie Gérard2024-04-055-5/+5
| | | | | | | | | | | | | They are licensed as test files. According to QUIP-18 [1], all test files should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I5bc3e4d40c4d46a5499c9cd19480c5cdf36489f2 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Use NO_GENERATE_CPP_EXPORTS explicitlyAlexey Edelev2024-03-201-0/+1
| | | | | | | | | Use NO_GENERATE_CPP_EXPORTS explicitly for modules that don't need the autogenerated exports header file. Task-number: QTBUG-90492 Change-Id: I6b2b9949f4592de399517dc5e8c7bd96dc7120d6 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix build without features.qml-object-modelTasuku Suzuki2023-10-131-3/+8
| | | | | | | | Introduce a new feature quicktemplates2-container for Container type quicktemplates2-container depends on qml-object-model Change-Id: Ic26f4b8bf390a04644b22e8067669a79b9d85e17 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix build with -no-feature-listview and itemviewsTasuku Suzuki2023-04-131-0/+7
| | | | | | | | | | | | | tested with each/all of below -no-feature-gridview -no-feature-listview -no-feature-pathview -no-feature-tableview -no-feature-treeview Pick-to: 6.5 Change-Id: I90cc7bc45bb9065000bc0fc7eeb8e80f02acb0d0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add StyleInfo singleton to Qt.test.controls helper moduleMitch Curtis2023-02-162-0/+16
| | | | | | | | | | | This allows accessing the current style in QML auto tests, which we need to conditionally skip certain tests after the Material 3 TextField/TextArea changes. Task-number: QTBUG-97993 Pick-to: 6.5 Change-Id: Ife4ca79deb96f17e879353a901e421b03b29ff25 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* qtest_quickcontrols_p.h: don't mark functions file-staticMarc Mutz2023-01-201-2/+2
| | | | | | | | | | | | | | | | | | It's a header, and at least tst_styleimports.cpp doesn't use all of the functions, so throws a -Wunused-function warning on Clang 15 for runTests(): qtest_quickcontrols_p.h:36:12: warning: unused function 'runTests' [-Wunused-function] static int runTests(QObject *testObject, int argc, char *argv[]) ^ Fix by marking the functions as inline instead. Amends e310dadef779b28845b41fb091634cd001cda9de. Pick-to: 6.5 6.4 6.2 Change-Id: Id6cee7bdc2fe93a5e034d7ed445dc5f2c5d35360 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Port from container::count() and length() to size()Marc Mutz2022-10-071-2/+2
| | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8: auto QtContainerClass = anyOf( expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o), expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)); makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container', with the extended set of container classes recognized. Change-Id: Idb1f75dfe2323bd1d9e8b4d58d54f1b4b80c7ed7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix warning from ignoring return of [nodiscard] methodVolker Hilsheimer2022-09-181-3/+12
| | | | | | | | | | | | | Compiler warns: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result] Pick-to: 6.4 Change-Id: If10d41fad7dc77b36eecc8725de178b0908f32de Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Drop unnecessary creation contexts from Quick ControlsUlf Hermann2022-09-093-0/+34
| | | | | | | | | | | | | | | Bound components can only be instantiated in the context they're declared in. Adding a context in between before instantiating a component makes it impossible to bind the component. We want to use bound components so that we can safely use IDs of other objects from the same context inside the objects created from the component. Pick-to: 6.4 Fixes: QTBUG-106042 Change-Id: I7a0e1ea3e079ccd0f5fe156f07f8bc62149c6c0a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix flaky tst_QQuickFileDialogImpl::goUpIntoLargeFolder testMitch Curtis2022-09-081-2/+10
| | | | | | | | | | | | | | | | Ensure that all expected delegates have loaded before trying to verify that the correct file is selected. This requires a modification to verifyFileDialogDelegates to account for the large amount of files that goUpIntoLargeFolder deals with, as QTest's failure message is limited to 1024 characters. Fixes: QTBUG-101488 Pick-to: 6.2 6.3 6.4 Change-Id: I65cf6ffc4724309083899dac2acc1f04a11a1220 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-09-071-1/+1
| | | | | | | Task-number: QTBUG-105718 Change-Id: Id89ed14990804a5024183e75382cc539d4293da1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Add license headers to cmake filesLucie Gérard2022-07-081-0/+3
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I72c89a98c42bbc9234d8495e9e503bec81d11037 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* tst_QQuickFileDialogImpl: check that closing the dialog rejectsMarc Mutz2022-06-211-0/+7
| | | | | | | | | | It doesn't. Task-number: QTBUG-101973 Pick-to: 6.4 6.3 6.2 Change-Id: I63a76f9919a4b9a1ebc3b2f95189b518e9c6858b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QQuickApplicationHelper: move initialProperties before qmlImportPathsMitch Curtis2022-06-153-5/+5
| | | | | | | | | | | It's far more common to want to initialize certain properties in the QML file, so this should come before qmlImportPaths so that users of the (private) API do not need to pass an empty QStringList (for qmlImportPaths) each time they want to provide initial properties. Pick-to: 6.2 6.3 6.4 Change-Id: I91ee4f1c1d69c83de3800af2f704c4c8a19d812d Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* quick/controlstestutils: add [[nodiscard]] to functions returning stuffMitch Curtis2022-06-131-1/+1
| | | | | | | | This way we'll get warned when the return value is not used. Pick-to: 6.2 6.3 6.4 Change-Id: If93abf2760b2ae3165720512c7d7f8dfa2600cf4 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-115-157/+10
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* tst_qquickfiledialogimpl: refactor duplicated code into helpersMitch Curtis2022-06-061-1/+11
| | | | | | Pick-to: 6.2 6.3 Change-Id: I1445d41dbbbe346506195c160e87d0b05770d22c Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* QtQuickTest: add API for checking for polish at window levelMitch Curtis2022-06-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a qIsPolishScheduled(QQuickWindow *) overload of qIsPolishScheduled(QQuickItem *) (added in 40d6072bc8a4df0fe1a16025fe30fe653463a446) and deprecates qWaitForItemPolished() (added in 7a3cad0619662b992154e075ec6b840bfc8a46a7) in favor of qWaitForPolish(), which has QQuickItem* and QQuickWindow* overloads. The existing functions that take QQuickItem are useful, but testing Qt Quick applications can be made even easier by allowing users to check if a window has any items that need to be polished. This information is already present (in QQuickWindowPrivate::itemsToPolish), so it's very efficient to check for. This is especially useful now that Qt Quick Layouts using polishing for their layouting, for example, as it's no longer necessary to find individual polishable items in complex hierarchies before proceeding to interact with child items. [ChangeLog][QtQuickTest][QQuickTest] Added QQuickTest::qIsPolishScheduled(QQuickWindow *) and QQuickTest::qWaitForPolish(QQuickWindow *) functions for verifying that updatePolish() was called on one or more items managed by a window. [ChangeLog][QtQuickTest][QQuickTest] Deprecated QQuickTest::qWaitForItemPolished(QQuickItem *). Use the new QQuickTest::qWaitForPolish(QQuickItem *) function instead. Fixes: QTBUG-93757 Change-Id: I95b6e051b3c9fd2fa93604f4d9ccda486bb29f9d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Add FolderDialogMitch Curtis2021-12-103-0/+165
| | | | | | | | | | | [ChangeLog][QtQuickDialogs] Added FolderDialog. This is a native FolderDialog on platforms that support it, and a non-native Qt Quick FolderDialog on platforms that don't. Task-number: QTBUG-87798 Change-Id: I95d872f450b528e54dd26f5421b6c5a4b71a9bc3 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Use up-to date LGPL license headerKai Köhne2021-11-292-22/+28
| | | | | | | | Remove usages of outdated LGPL3 header that references LICENSES.LGPLv3 instead of LICENSES.LGPL3. Change-Id: If7a90ec18331a68491c5a740f131a5e7b3f37df4 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Consolidate test helpers into private librariesMitch Curtis2021-09-135-0/+546
Previously each test would include and build sources from the shared folder. Now we make those sources a library, build it once, then have each test link to it instead. We also take the opportunity to move some helpers that qtquickcontrols2 had added into the quicktestutils library where it makes sense, and for the helpers that don't make sense to be there, move them into quickcontrolstestutils. We add the libraries to src/ so that they are internal modules built as part of Qt, rather than tests. That way we can use them in a standalone test outside of qtdeclarative. Task-number: QTBUG-95621 Pick-to: 6.2 Change-Id: I0a2ab3976fdbff2e4414df7bdc0808f16453b80a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>