aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/shared/visualtestutil.h
Commit message (Collapse)AuthorAgeFilesLines
* Restructure tests in preparation for merging into qtdeclarativeMitch Curtis2021-07-221-252/+0
| | | | | | | Task-number: QTBUG-95173 Change-Id: I541dc26cf2cdd6f2640824f693f7d059445367d9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Do not keep QML engines alive across qmlClearTypeRegistrations()Ulf Hermann2021-06-171-1/+2
| | | | | | | | | | Otherwise the builtins don't get re-registered afterwards. Fixes: QTBUG-94575 Pick-to: 6.2 Change-Id: I7fa4965d5147adf0cc437d1b6102815cc206a6ea Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Update to latest qml CMake APICraig Scott2021-06-051-0/+1
| | | | | | | | | | | | | | The new qml CMake API places a closer relationship between the backing target and the plugin target. Both are typically created together and they share a lot of common details. Instead of creating them in different parts of the source tree, they are now specified together. The src/imports area has effectively been absorbed into the other corresponding subdirectories below src with this change. Task-number: QTBUG-91621 Change-Id: I9bd32e9eb78c198ccc9db04e2829303cac323502 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add QtQuick.DialogsMitch Curtis2021-05-271-0/+14
| | | | | | | | | | [ChangeLog][QtQuickDialogs] Added FileDialog. This is a native FileDialog on platforms that support it, and a non-native Qt Quick FileDialog on platforms that don't. Fixes: QTBUG-87797 Change-Id: Ia3a98b616479b818c96c232a0329750023079642 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQuickApplicationHelper: error-check after createWithInitialPropertiesMitch Curtis2021-04-271-1/+1
| | | | | | | | Unlike create(), it does produce errors that will not always be noticeable if we don't check for them. Change-Id: Ia3adad6937de5f9b923e0e1593486b8ae11c3c68 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add initialProperties argument to QQuickApplicationHelperMitch Curtis2021-04-221-2/+3
| | | | | | | This allows setting required properties on loaded QML components. Change-Id: I9737cf85fac027077df234a02f81f5499e0cb6b5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add findViewDelegateItem function to visualtestutils.hMitch Curtis2021-04-221-0/+11
| | | | | | | | | | This helper function finds an item view delegate instance at a given index, ensuring that the view is polished and positioned at the correct index if necessary. Change-Id: Ib133914df723251835be3812c1d0654c07a99f14 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Add clickButton and doubleClickButton functions to visualtestutils.hMitch Curtis2021-04-221-0/+5
| | | | | | | | | These helper functions save the hassle of calculating the click position within the window manually, and do a lot of other sanity checks in addition. Change-Id: I8cb53fab9c1addea15e8066e347a5c4af2700c2e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Support compile-time style selectionMitch Curtis2020-09-241-3/+7
| | | | | | | | | | | | | | By allowing importing styles without first importing QtQuick.Controls, which does runtime style selection. [ChangeLog][Styles] It's now possible to select a style at compile-time by importing that style explicitly instead of QtQuick.Controls. This avoids the need to do run-time style selection and hence deploy the QtQuick.Controls plugin with the application. Change-Id: I666d6dc7727fffd2c7b05743855f2086f076465a Fixes: QTBUG-86284 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Menu: Close menu by Alt key on platforms supporting mnemonic shortcutsYuya Nishihara2020-09-021-0/+17
| | | | | | | | | | | | | | | | | | | | | | | This is close to what the widget QMenu (and Windows native menu) do. Before, the active menu was left open and Alt+<key> shortcut would be delivered to one of the matching items, which might be an item shadowed by the active menu popup. With this patch, the active menu is closed on Alt key pressed so the subsequent shortcut event will (likely) be delivered to the matching MenuBar item. Since I'm going to fix the issue of &mnemonic key conflict resolution, I need to first change the way of delivering a shortcut event to the parent MenuBar. The test cases use the undocumented function to simulate low-level behavior of Alt itself and Alt+<key> events. Apparently, there's no public QTest function to send multiple key events without releasing Alt modifier. Task-number: QTBUG-86276 Pick-to: 5.15 Change-Id: I0ed6ea94f0fee7983a5cb6352d388036d3a1f8df Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Use qmlRegisterModuleImport() to register stylesMitch Curtis2020-08-261-3/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch completes the cumulative work done in previous patches. - Uses qmlRegisterModuleImport() to register styles. This has some added requirements: - Each style must now be a QML module -- that is, it must have a qmldir file. - As a result of the above, the module must be available within the QML import path in order to be found. - The various forms of accepted style names have been reduced down to one ("Material", "MyStyle", etc). See below for an explanation of why. - The following API in QQuickStyle is removed: addStylePath(), availableStyles(), path(), stylePathList(). These no longer make sense now that we reuse the existing QML import system. - Adds the tst_qquickstyleselector auto test back as "styleimports". qmlRegisterModuleImport() vs resolvedUrl() Previously we would use QQuickStyleSelector to select individual QML files based on which style was set. We'd do this once when QtQuick.Controls was first imported. With Qt 6, and the requirement that each style be a proper QML module, qmlRegisterModuleImport() was introduced. This allows us to "link" one import with another. For an example of what this looks like in practice, suppose the style was set to "MyStyle", and the fallback to "Material". The "QtQuick.Controls" import will be linked to "MyStyle", "MyStyle" to "QtQuick.Controls.Material", and as a final fallback (for controls like Action which only the Default style implements), "QtQuick.Controls.Material" to "QtQuick.Controls.Default". This is the same behavior as in Qt 5 (see qquickstyleselector.cpp): // 1) requested style (e.g. "MyStyle", included in d->selectors) // 2) fallback style (e.g. "Material", included in d->selectors) // 3) default style (empty selector, not in d->selectors) This is a necessary step to enable compilation of QML to C++. Reducing the set of accepted style names The problem In QtQuickControls2Plugin() we need to call QQuickStylePrivate::init(baseUrl()) in order to detect if the style is a custom style in QQuickStyleSpec::resolve() (by checking if the style path starts with the base URL). In Qt 5, init() is called in QtQuickControls2Plugin::registerTypes(), but in Qt 6 that's too late, because we need to call qmlRegisterModuleImport() in the constructor. qmlRegisterModuleImport() itself requires the style to have already been set in order to create the correct import URI ("QtQuick.Controls.X" for built-in styles, "MyCustomStyle" for custom styles). The solution By reducing the valid forms for style names down to one: ./myapp -style MyStyle we solve the problem of needing baseUrl() to determine if the style is a custom style or not, but needing to call it too early (since we now call qmlRegisterModuleImport() in QtQuickControls2Plugin(), which itself requires the style to have already been set). baseUrl() can't have been set before the constructor is finished. All of the various forms for _setting_ a style are still valid; environment variables, qtquickcontrols2.conf, etc. [ChangeLog][Important Behavior Changes] Custom styles must now have a qmldir that lists the files that the style implements. For example, for a style that only implements Button: --- module MyStyle Button 1.0 Button.qml --- In addition, there is now only one valid, case-sensitive form for style names: "Material", "MyStyle", etc. These changes are done to help enable the compilation of QML code to C++, as well as improve tooling capabilities. [ChangeLog][Important Behavior Changes] The following API was removed: - QQuickStyle::addStylePath() - QQuickStyle::availableStyles() - QQuickStyle::path() - QQuickStyle::stylePathList() - QT_QUICK_CONTROLS_STYLE_PATH This API is no longer necessary and/or able to be provided now that styles are treated as regular QML modules. Task-number: QTBUG-82922 Change-Id: I3b281131903c7c3c1cf0616eb7486a872dccd730 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQuickApplicationHelper: don't use QTest macros outside test functionsMitch Curtis2020-06-171-5/+30
| | | | | | | | | This has no effect. Task-number: QTBUG-66320 Pick-to: 5.15 5.12 Change-Id: Ie6efb26243178c4044ac0bc721c21ad89769c982 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Tests: move duplicated addTestRows() to QQuickVisualTestUtilJ-P Nurmi2018-04-121-0/+2
| | | | | Change-Id: I723f1fe2e5df1ea4a09bd7e567079cdbc7124e6e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix failing tests in tst_menu and tst_qquickmenubarMitch Curtis2017-08-091-0/+2
| | | | | | | | | | | | | | | As mentioned in the bug report for the failing tst_qquickmenubar test, the window is sometimes opened at the bottom right corner of the screen on the Ubuntu CI machines. However, even after centering the window on the screen, the old setPos() call still caused the tests to fail. So, we position the cursor past a different corner of the window, which works.. though I don't know why. Task-number: QTBUG-62363 Task-number: QTBUG-62383 Change-Id: I3649230002eaac5a6391daff24427e6f9f58cfa5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Stabilize tst_menuJ-P Nurmi2017-06-121-0/+2
| | | | | | | | | | Add QQuickVisualTestUtil::moveMouseAway() (adapted from qtdeclarative) to help with testing menus that are now highlighting items on hover. It is important to move the mouse cursor away outside the window in such tests where hover highlight might conflict with the test. Change-Id: If3d642dd4f3ba2936a0d22c078d8fb0125d16c6c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Welcome to 2017J-P Nurmi2017-01-091-1/+1
| | | | | Change-Id: If68cff4efacc7dc5719c8b8e61937e85e9076870 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* auto tests: allow using QQuickWindow with QQuickApplicationHelperJ-P Nurmi2016-09-051-3/+5
| | | | | | | | This allows us to run the relevant popup tests for both QQuickWindow and QQuickApplicationWindow. Change-Id: I14b6435afeeb8a6cf640d8c52ad1d9e1fae070b0 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Templates: rename the C++ module to qtquicktemplates2J-P Nurmi2016-04-131-1/+1
| | | | | Change-Id: I146da903b46f5c2caf865e37291c25376b49021a Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Rename Qt Labs Controls to Qt Quick Controls 2 - build systemMitch Curtis2016-03-181-1/+1
| | | | | | | | | The imports will be done later, as we don't want to change them until the module is releasable (which requires things like selection handles, etc.). Change-Id: I2140cff7058fc3b696e92ca8c0e5e06dca9a7c9c Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Move ApplicationHelper to visualtestutil.h and rename itMitch Curtis2015-12-101-0/+26
| | | | | | | This class is useful for other auto tests, like Popup's. Change-Id: Ie193c07e5b53b67493fceba9a1c32798db2f4e34 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Add ApplicationWindow auto tests.Mitch Curtis2015-07-211-0/+112
These were copied from Qt Quick Controls. There are some issues with regards to QQuickThemeData, so some are commented out for now (see tests for details). I also added a test for QTBUG-47318. Change-Id: Iaee0f4531b8d7bc9b4984146aaf00b76afa77793 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>