aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktestutils/quick/viewtestutils.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QQuickView::showView() return true if the platform is WaylandFrederic Lefebvre2025-11-131-0/+4
| | | | | | | | | | | | | | | | | QQuickView::showView() return true if the platform is Wayland, this is done before the position check. setPos and setFramePosition do not work properly on Wayland causing all tests that are calling showView to consistently fail due to this. If the platform used is Wayland, showView return true before the position check has been performed. Fix the following failing tests: tst_HoverHandler::changeCursor, tst_HoverHandler::deviceCursor,tst_HoverHandler::touchDrag tst_HoverHandler::window Change-Id: I18a4145643eb9cc76ce7fe55dd964904dcffa95e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Port away from QPairZhao Yuhang2025-04-121-12/+12
| | | | | | | | QPair is just an alias of std::pair anyway. Task-number: QTBUG-115841 Change-Id: I26fc90adcc775aac9955ad57304af914dc4ed48f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Check if showView uses updated positionFrédéric Lefebvre2025-02-131-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | ShowView sets a position to a qquickview. The position takes some time to be updated. In some cases a race condition can happen on Opensuse and the un-updated position is used. Check if the qquickview has a frame. If it does not have one, return true. If it has a frame, verify that its position is correct. Check if the starting framePosition and ending position of the qquickview are the same. Use qWaitFor to check if the position updated. Return false if it haven't. If the qquickview does not have a frame, the position check is not reached. Fixes: QTBUG-133341 Fixes: QTBUG-132648 Fixes: QTBUG-132630 Fixes: QTBUG-133342 Fixes: QTBUG-133343 Fixes: QTBUG-132941 Fixes: QTBUG-133344 Pick-to: 6.9 6.8 6.5 Task-number: QTBUG-133340 Change-Id: I866a9d2bd2499cafcbfa4ccd53a770846590a7bd Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Share code between QQuickViewTestUtils and QQuickVisualTestUtilsTor Arne Vestbø2024-09-271-2/+2
| | | | | | | | We don't need two implementations of centerOnScreen(). Pick-to: 6.8 Change-Id: I43fbb00126547e49dad0d7b266948468a358c63e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QuickTestUtils: Log reason for showView() failingUlf Hermann2024-09-091-3/+13
| | | | | | | | | | | There are a number of reasons for QQuickTest::showView() to fail. Most of the time we want to see the details in the CI log so that we have a chance of figuring out what is going on. Task-number: QTBUG-128645 Change-Id: I59d80a24d64257364a4a2dd98389b871f5284b3f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Replace mouse-only flick, moveAndPress, moveAndRelease in testsShawn Rutledge2024-07-021-38/+46
| | | | | | | | | | | Since d7623d79ef4bc9533fced027bf1d173d68b4eba6 Flickable has worked directly with touch events; and we are expected to have stylus devices (QTabletEvents) working well too. So we need to be able to expand the test coverage to more types of devices. This is the first step. Pick-to: 6.8 Change-Id: I93a3a4b84424eb69e0cd7c9f4ebe58b9f27082d9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQuickTest::initView: don't do things on Wayland that aren't allowedShawn Rutledge2024-06-291-10/+13
| | | | | | | | | Neither exact window positioning nor QCursor::setPos() are allowed. Attempting to do it results in warnings, which tests treat as failures. Pick-to: 6.8 Change-Id: I1cd23147e52e833b151df5367b2753b4b453fa2d Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Call QQuickItem::mouseUngrabEvent() on ungrab from QTabletEventShawn Rutledge2024-06-281-10/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As long as we rely on QGuiApplicationPrivate::processTabletEvent() to synthesize mouse events from tablet events (we aren't doing it on the fly as with touch events in 468626e99a90d6ac21cb311cde05c658ccb3b781), and as long as most QQuickItems are not handling tablet events, QQuickDeliveryAgentPrivate::onGrabChanged() almost always sees a QMouseEvent losing its grab when e.g. ListView takes over from one of its delegates while the user is trying to scroll with a stylus device. This event's device is the stylus, though. Whenever we see an EventPoint being canceled or ungrabbed, we must call either mouseUngrabEvent() on the item, or touchUngrabEvent() if all the points are released or cancelled, to avoid items getting "stuck" in pressed state. It must not be skipped. So call mouseUngrabEvent() whenever the event is a QSinglePointEvent, and touchUngrabEvent() otherwise (since only touchscreens send multi-point events). Make QQuickTest::pointerPress/Move/Release functions more correct for stylus devices: - we need the timestamp to monotonically increase, even though QTest::defaultMouseDelay() is usually 0 (which isn't sensible) - QTest::mouseEvent() calls qt_handleMouseEvent which converts logical coordinates to native positions; but for tablet events, do it here for now, since there are no QTest methods to generate them. This helps QQuickFlickablePrivate::handleMoveEvent() to calculate deltas correctly. Fixes: QTBUG-118903 Pick-to: 6.8 6.7 6.6 6.5 Change-Id: I5ec54c5181f5b9137fe16248884010aea94f671a Reviewed-by: Doris Verria <doris.verria@qt.io>
* Correct license for test filesLucie Gérard2024-04-111-1/+1
| | | | | | | | | | | | | 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 Task-number: QTBUG-121787 Pick-to: 6.7 Change-Id: Ib1dea3bf095aeb06e33a64db61a8c01219d12345 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* Fix ubsan build of qtdeclarativeAllan Sandfeld Jensen2024-02-061-1/+1
| | | | | | | | | | Avoid using private classes when not exported Pick-to: 6.7 Change-Id: Ia2dd8019719739a2cb66a0770f0156ab711a2dd8 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix build with -no-feature-listview and itemviewsTasuku Suzuki2023-04-131-0/+5
| | | | | | | | | | | | | 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>
* QQuickTest::initView: set minimum window width and height if unsetShawn Rutledge2022-10-241-0/+4
| | | | | | | | | | | | | | | When writing a new test, it's easy to forget to set the root item's width and height, and that's ok on any desktop platform: the QPA plugin or the window system will give it a reasonable minimum size anyway (100x100 or so). But on some embedded platforms the minimum window size is much smaller, such as 1x1; and then we can end up with CI failures that take too long to troubleshoot. So if width or height is not set (and thus 0), set it to 100. Fixes: QTBUG-107865 Change-Id: If6c300d6ff43e3ba8d9142c550579ef7d58d87fb Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add QQuickTest::pointerPress/Move/Release convenience functionsShawn Rutledge2022-10-201-0/+87
| | | | | | | | | | | | | | | | | | | More autotests should test mouse, especially touch and maybe tablet events, with similar expectations, instead of testing mainly mouse and mostly neglecting the other device types. This makes it easier to work with data-driven tests that take specific QPointingDevice instances as test data. Started using them in tst_TapHandler::gesturePolicyDragWithinBounds() which was already data-driven by device type. Clearly, this code is now easier to read and less repetitious. In tst_qquickwindow::subclassWithPointerEventVirtualOverrides() the improvement is somewhat smaller, but this test validates that tablet events are working. Change-Id: I74d0fcc2f082af3737a0754c58205fa2b18c1a2d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Port from container::count() and length() to size()Marc Mutz2022-10-071-15/+15
| | | | | | | | | | | | | | | | | | | | 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>
* Use SPDX license identifiersLucie Gérard2022-06-111-27/+2
| | | | | | | | | | | | 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>
* QuickTestUtilsPrivate: includemocsMarc Mutz2022-04-291-0/+2
| | | | | | | | | | | | Including moc files directly into their classes' TU tends to improve codegen and enables extended compiler warnings, e.g. about unused private functions or fields. Pick-to: 6.3 6.2 5.15 Task-number: QTBUG-102948 Change-Id: I3c9d74e94b0fbbf1e5e9d59522f400485c959cb5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Consolidate test helpers into private librariesMitch Curtis2021-09-131-0/+533
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>