aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/shared
Commit message (Collapse)AuthorAgeFilesLines
* 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-052-1/+2
| | | | | | | | | | | | | | 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-272-0/+158
| | | | | | | | | | [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-223-1/+41
| | | | | | | | | | 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-222-0/+79
| | | | | | | | | 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>
* Ensure that C++ Qt Quick tests are run with all applicable stylesMitch Curtis2021-01-131-1/+5
| | | | | | | | | | | | | Since 8b534487044dfb3b464431ecb91ef4e0864af4ed, the C++ tests were only being run with the default style for the platform that they were run on. Fix this by keeping track of whether a default style is in use and checking it in the tests. Pick-to: 6.0 Change-Id: I4ddd90aba12ede83fff0d3d1002534e79fce8c87 Reviewed-by: Fabian Kosmale <fabian.kosmale@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>
* Fix compile warning from deprecated application attributesVolker Hilsheimer2020-09-151-1/+0
| | | | | | | | | | | AA_DisableHighDpiScaling and AA_UseHighDpiPixmaps have been deprecated. As of 90358f6042d1fe2db849e17e1b0c875fb0560b20 and 2dc46c09026362cc267b1183faf09fb29479ef93 in qtbase, respectively, these settings are deprecated and have no effect. Change-Id: I1eb1f77a64893dd077bd08216d26633d43e1e0e3 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Menu: Close menu by Alt key on platforms supporting mnemonic shortcutsYuya Nishihara2020-09-022-0/+44
| | | | | | | | | | | | | | | | | | | | | | | 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-264-10/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Register C++ types declarativelyMitch Curtis2020-08-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Adapt to the new way of registering C++ types. The types need to be seen at compile time so that code can be generated that invokes them. This patch: - Adds QML_* macros where applicable. - Adapts the build system files to the new way of registering modules. - Splits up the QtQuick.Controls[.*].impl files into their own plugins, as we can only register one QML module per .pro file. - Removes C++ type registration calls in every plugin. - Moves private types from src/quickcontrols2/quickcontrols2.pro to src/quickcontrols2/impl/quickcontrols2-impl.pro. Some of these types need to be exposed to QML, but quickcontrols2.pro is already in use to declare the QtQuick.Controls import (and also provides the public C++ QQuickStyle API), and the new QML_IMPORT_NAME/VERSION syntax only allows one module per project. As some of the types that need to be exposed to QML are also referenced by some C++ code (e.g. tests, etc.), we just move all of the private types to the new library. Follow-up patches will register the QML types declaratively. Task-number: QTBUG-82922 Change-Id: Iaf9ee106237d61701d57a8896f3822304c8151a6 Reviewed-by: Ulf Hermann <ulf.hermann@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>
* Reduce dependencies on QtGraphicalEffectsMitch Curtis2020-05-132-0/+10
| | | | | | | | - Make QtGraphicalEffects optional in tests - Mention that QtGraphicalEffects is required for relevant examples Change-Id: I3ac7d06add931e0a10c3df7edc4e458ba5519c75 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-04-252-3/+10
|\ | | | | | | Change-Id: Ibf39232616ea6ef67242b70011aa683ce8dc0b4f
| * Use resource path for test data on Android and iOSMitch Curtis2019-04-242-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qtbase/mkspecs/features/testcase.prf already generates a .qrc file containing the files in TESTDATA, so instead of trying to copy QML files to the device, we can just use the existing resources. This fixes the following failure, which affects all tests using util.pri: FAIL! : tst_cursor::initTestCase() 'QDir::setCurrent(m_directory)' returned FALSE. (Could not chdir to :/) Change-Id: I1fd7449437be045a7230a7679e24252cdf9c0ccc Fixes: QTBUG-73604 Fixes: QTBUG-73606 Fixes: QTBUG-73607 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2019-01-101-61/+0
|\| | | | | | | | | | | | | | | Conflicts: .qmake.conf src/imports/controls/qtquickcontrols2plugin.cpp Change-Id: I27f1260b539354e084beb28be78385e57fda63e1
| * Revert all Menu delegate patchesv5.12.0-rc2v5.12.0-rc1v5.12.0Mitch Curtis2018-11-151-61/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts the following commits: d5cb26bc56a3b6f6e99c88654d4f7a65f43551ac - Menu: ensure the correct delegates are used when created via Component d923dd467c1aeb3e195a09949b04862084002f88 - MenuBar: ensure the correct delegates are used when created via Component d56c193eb4ceb640611d66f22e1f26aae91cd7d1 - QQuickPopupPositioner: avoid adding duplicate item change listeners 567a2de8cd493aabe0055d6dbc367b39447e70dd - Stabilize tst_qquickmenubar 953fbac6131823e4fce0eb4707a854469c4c04ff - Fix Instantiator-created MenuItems disappearing 936d31179d44220571ded15840bedeccb581c83b - tst_qquickmenu: add a test for MenuItems before and after a Repeater fc1832810f6c09505d9413685ed0b2d6295bea4a - QQuickMenuBar: fix menu not opening The fix for QTBUG-67559 has caused lots of issues, with the latest being a crash right before the 5.12 release. The bug that they fix is a P2, so it's not worth the hassle. The patches might be able to be resubmitted to dev after the crash is fixed. Change-Id: Ic192c7a302176bcdb2503b636b3462b10898a2ba Fixes: QTBUG-71770 Reviewed-by: J-P Nurmi <jpnurmi@gmail.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-11-031-1/+5
|\| | | | | | | Change-Id: I4ebc848bf78a74fb26a630d8a4839f104612ff74
| * Fix heap-use-after-free in tst_QQuickDrawerMitch Curtis2018-10-261-1/+5
| | | | | | | | | | | | | | | | | | Ensure the QByteArray we set as the current test name outlives the test. Task-number: QTBUG-71387 Change-Id: Id5f75b5ffcd1a710b5d8be4796cf48ee8dd1896d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Remove support for GPU_BLACKLIST files from some testsEdward Welbourne2018-10-121-4/+0
|/ | | | | | | The feature is no longer used and support for it shall soon be dropped. Change-Id: I9b35b43262b6f07609cf931315125e91e0a1f9b6 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Merge remote-tracking branch 'origin/5.11' into 5.12Qt Forward Merge Bot2018-09-111-0/+61
|\ | | | | | | Change-Id: I3fa0011d8b69db2a004feb177a7f89ccb75a724d
| * Menu: ensure the correct delegates are used when created via ComponentMitch Curtis2018-09-051-0/+61
| | | | | | | | | | | | | | | | | | | | Don't add items until we're complete, as the delegate could change in the meantime. Instead, add them to contentData and create them when we're complete. Task-number: QTBUG-67559 Change-Id: I5f42129f49de861ff5f15d0069daeda0b4e5017c Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* | Tests: fix QQuickVisualTestUtil::addTestRowForEachControl()J-P Nurmi2018-04-121-1/+4
| | | | | | | | | | | | | | | | | | Since fe7d1b89, the Default style is unconditionally available in resources. This made tst_objectcount fail, because it was calling QUrl::fromLocalFile() for a file path in resources. Change-Id: I99ccdea7f7bad65620fcf41c0554e7fdd8677611 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Tests: move duplicated addTestRows() to QQuickVisualTestUtilJ-P Nurmi2018-04-123-0/+41
|/ | | | | Change-Id: I723f1fe2e5df1ea4a09bd7e567079cdbc7124e6e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix failing tests in tst_menu and tst_qquickmenubarMitch Curtis2017-08-092-1/+13
| | | | | | | | | | | | | | | 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>
* Auto tests: incorporate the QEvent::Leave trick to moveMouseAway()J-P Nurmi2017-07-211-2/+6
| | | | | | | | | | | 6f1eba89 used QEvent::Leave to make QQuickWindow clear its last known mouse position, which ensures that QQuickWindow won't send unexpected hover events from flushFrameSynchronousEvents(). The same hover events are causing trouble in tst_qquickmenubar too, so incorporate the leave event trick to moveMouseAway() to benefit from it in other tests too. Change-Id: I25a285d008d1cb639c7be09d714e482d472b4e50 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix QTEST_QUICKCONTROLS_MAIN()J-P Nurmi2017-07-061-5/+4
| | | | | | | | | | | | QTestResult::setCurrentTestObject(const char *name) does not make a copy of the char array. Make sure to keep the QByteArray instance alive in scope until QTest::qCleanup() has been executed to avoid printing random garbage in the footer: ********* Finished testing of ??????????? ********* Change-Id: I21e0165485b07070f4eec0f254a962fd3f06031f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add QTEST_QUICKCONTROLS_MAIN()J-P Nurmi2017-07-052-2/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By default, repeat the auto tests with all available styles: $ ./tst_qquickmenubar ********* Start testing of tst_QQuickMenuBar ********* Config: Using QtTest library 5.10.0, Qt 5.10.0 (...) PASS : tst_QQuickMenuBar::Default::initTestCase() PASS : tst_QQuickMenuBar::Default::example() PASS : tst_QQuickMenuBar::Default::cleanupTestCase() [...] PASS : tst_QQuickMenuBar::Universal::initTestCase() PASS : tst_QQuickMenuBar::Universal::example() PASS : tst_QQuickMenuBar::Universal::cleanupTestCase() Totals: 12 passed, 0 failed, 0 skipped, 0 blacklisted, 2215ms ********* Finished testing of tst_QQuickMenuBar ********* When explicitly specified, run only with that one style: $ ./tst_qquickmenubar -style material ********* Start testing of tst_QQuickMenuBar ********* Config: Using QtTest library 5.10.0, Qt 5.10.0 (...) PASS : tst_QQuickMenuBar::Material::initTestCase() PASS : tst_QQuickMenuBar::Material::example() PASS : tst_QQuickMenuBar::Material::cleanupTestCase() Totals: 3 passed, 0 failed, 0 skipped, 0 blacklisted, 984ms ********* Finished testing of tst_QQuickMenuBar ********* Change-Id: Iad250eb373e6957fee259dc33f894b87413ded48 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io>
* Stabilize tst_menuJ-P Nurmi2017-06-122-0/+11
| | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.8' into devJ-P Nurmi2017-01-114-4/+4
|\ | | | | | | Change-Id: If797ac58344b20e8de4379343131c097247ba2f2
| * Welcome to 2017J-P Nurmi2017-01-094-4/+4
| | | | | | | | | | Change-Id: If68cff4efacc7dc5719c8b8e61937e85e9076870 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Whitespace cleanupsJ-P Nurmi2016-11-031-1/+1
|/ | | | | Change-Id: Ia075694a7dc43d72d07221b569467fcebdb411fb 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-132-2/+2
| | | | | Change-Id: I146da903b46f5c2caf865e37291c25376b49021a Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Rename Qt Labs Controls to Qt Quick Controls 2 - build systemMitch Curtis2016-03-182-2/+2
| | | | | | | | | 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-102-1/+27
| | | | | | | 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-215-0/+430
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>