aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quicktest
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-254-0/+25
|\ | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/qmltest/quicktest.cpp tests/auto/qml/qmlcachegen/qmlcachegen.pro Change-Id: I70e96e8817d59647f876b8b77b30cdeede8f0662
| * QUICK_TEST_MAIN_WITH_SETUP: fix qmlEngineAvailable() being called too lateMitch Curtis2019-03-214-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When I added the macro, I wasn't aware that TestCaseCollector was a thing. TestCaseCollector loads each QML file without running the tests (i.e. creates a QQmlComponent from the file without creating an object from that component). Since it still executes imports, the test can fail if types are registered or import paths added in qmlEngineAvailable(), since it's called too late. So, call it earlier. This should have no adverse effect on user code, as nothing of importance to the user will be skipped, and the documentation already details what can be expected by the time qmlEngineAvailable() is called. Change-Id: Ibd3a4b728bc87b90f89cc310fddf668c5879ad83 Fixes: QTBUG-74160 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | TestCase: add isPolishScheduled() and waitForItemPolished()Mitch Curtis2018-12-103-0/+156
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These were introduced to the C++ QQuickTest namespace in 40d6072b and 7a3cad06, respectively. QML-only tests should also have access to them. [ChangeLog][QtQuickTest][TestCase] Added isPolishScheduled() function to allow checking if updatePolish() has been called on an item since the last call to its polish() function. This is useful to verify that a polish has been scheduled. [ChangeLog][QtQuickTest][TestCase] Added waitForItemPolished() for verifying that updatePolish() was called on an item. Change-Id: I3e3a488197e74546358e2d5b0da7a902793c1954 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-11-161-0/+60
|\| | | | | | | Change-Id: I34aa0c2eb178862b40e63b62c6daa056e5e204c6
| * Qt Quick Test: support tags filter on tests runKirill Burtsev2018-11-151-0/+60
| | | | | | | | | | | | | | | | Implemented logic for filtering tests with 'case::function:tag' run syntax. Fixes: QTBUG-71645 Change-Id: I9243636b098b4e9ccb4c74d08679bbbb9f3e8a65 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-11-092-1/+64
|\| | | | | | | Change-Id: I2ed93c9d5fa8ec9b075112618a2535535591a0e8
| * Fix TestCase::skip to ignore rest of the data rows in TestCaseKirill Burtsev2018-11-072-1/+64
| | | | | | | | | | | | | | Fixes: QTBUG-53131 Change-Id: Ic24fe4b5db0e404b1b089a054ce76265763f2682 Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Add QQuickTest::qWaitForItemPolished()Mitch Curtis2018-10-314-0/+133
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Verifying that an item was polished is quite common in Qt's auto tests: - The Qt Quick auto tests have a util function for it in visualtestutil.h (line 103). - "git grep polishScheduled -- tests/auto | wc -l" says that there are 269 usages of polishScheduled in Qt Quick auto tests, almost all of which look like this: QTRY_COMPARE(QQuickItemPrivate::get(item)->polishScheduled, false); - QQuickTableView's auto tests have their own function: #define WAIT_UNTIL_POLISHED \ QVERIFY(tableViewPrivate->polishScheduled); \ QTRY_VERIFY(!tableViewPrivate->polishScheduled) - More recently, QQuickMenu started requiring it (see menuutil.h). QQuickItem::polish() and QQuickItem::updatePolish() are both public functions, so the notion of polishing in Qt Quick is not new or hidden. This means that any user applications that have custom items that make use of the polish() => updatePolish() system will benefit from having a reliable method of testing their behavior. In addition, anyone wanting to simulate interaction with items in e.g. QQuickMenu will need this API if they don't want to use unreliable qWait() calls. With this in mind, this and the previous patch aim to standardise/ simplify the various private API checks and utility functions, and provide public API for users so that they can benefit from more reliable tests. When used together, the code will look like this: QVERIFY(QQuickTest::qIsPolishScheduled(item)); QVERIFY(QQuickTest::qWaitForItemPolished(item)); [ChangeLog][QtQuickTest][QQuickTest] Added QQuickTest::qWaitForItemPolished() for verifying that updatePolish() was called on an item. Fixes: QTBUG-71224 Change-Id: I8841910212e7f1a431ba845cae8a1ba7b4f4da67 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* Exit test executable with failure if specified test functions are not foundKari Oikarinen2018-06-218-1/+262
| | | | | | | | | | | | | | | | | | | | | | If QtQuickTest test executable was given filters that didn't match in any of the qml files run, it exited successfully. In combination with a Coin bug when the test function name contains a space, this allowed failing tests to pass the CI. If the test function fails, the repeat attempts would pass two arguments to the executable. Neither of those hit, but that wasn't considered a problem. Check that all of the test functions named on the command line are actually executed during the whole run and otherwise exit with a non-zero exit code. I assume there's no duplicates in the whole names of test functions scoped with testcase names. Task-number: QTBUG-68197 Change-Id: Icf7fe263945403f02920522dfd187aeb76b7cb3c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kalle Viironen <kalle.viironen@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-2/+2
| | | | | | | | | | | | | From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* tests: Wrap qWaitForWindow{Active,Exposed} in QVERIFYv5.11.0-beta1Kari Oikarinen2018-02-231-1/+1
| | | | | | | | | | | The functions are marked Q_REQUIRED_RESULT, so they give compilation warnings when not handling the bool return value. Failing the test early at an unexpected event is also better behavior anyway. Task-number: QTBUG-66559 Change-Id: I6c4db29379ec01528208c3e4ee54346b4230616c Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add QUICK_TEST_MAIN_WITH_SETUP to allow executing C++ before a QML testMitch Curtis2018-02-024-1/+107
| | | | | | | | | | | | | | | | | | | This macro is the same as QUICK_TEST_MAIN, but takes the user's QObject subclass as an argument, and calls pre-defined slots/invokable functions on it, similar to how e.g. init() is called for C++ tests. This allows e.g. context properties to be set for the QML tests. By basing the API on invokable functions, we give ourselves the freedom to easily add more functions in the future. [ChangeLog][QtQuickTest] Added QUICK_TEST_MAIN_WITH_SETUP macro to allow executing C++ before a QML test (such as registering context properties). Task-number: QTBUG-50064 Change-Id: Id566e388553811c220871248403d32545f8ae1eb Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Revert "Make QtQuickTest::mouseEvent use QTest::mouseX"Jani Heikkinen2017-09-043-91/+1
| | | | | | | | | | | | | It seems this is causing QTBUG-62925 and QTBUG-62926 so revert is the best option at this point to proceed This reverts commit 4c46dce8fd9c9dddddd1d07f56396b3eabb2efc4. Change-Id: Ia8ea85c1ac1ada1752b29c9fbd8439f5963d46d2 Reviewed-by: J-P Nurmi <jpnurmi@qt.io> Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Make QtQuickTest::mouseEvent use QTest::mouseXAlbert Astals Cid2017-08-303-1/+91
| | | | | | | | | | | | Fixes QQuickItem::isUnderMouse returning wrong information when moving the mouse cursor with QtQuickTest::mouseX Also changes TestCase.mouseDrag to actually resemble more what real life does, i.e. send mouse moves with the same localPos if the item has already moved and update tst_drag.qml accordingly Change-Id: I80e4ab097da90d21ba987466c1b82467755a6b56 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix SignalSpy with QQmlPropertyMap signalsAlbert Astals Cid2016-11-306-0/+246
2e7d4ecdc59942b484159ca827f5d5dbc8787a1b caused the regression. To fix the regression I try accessing the signal name first and if it is not a function try accessing the handler name. Comes with a unit test to test both cases. Change-Id: I3897f344df9c6219636c70259eed503d9b76f09e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>