aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktestutils/quick
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>
* QQuickVisualTestUtils: fix bug in forEachStepMitch Curtis2025-04-231-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The calculation for progress was wrong. With enough steps moving towards a position that's centered over an item, this wouldn't have been noticeable. However, with only a couple of steps, it will fail to reach its target. Before: i=0, progress=0 i=1, progress=0.333333 i=2, progress=0.666667 After: i=0, progress=0 i=1, progress=0.5 i=2, progress=1 forEachStep(1, func) is silly: then there is just one step, so we only call func(1.0) once, and avoid divide-by-zero. Task-number: QTBUG-105856 Task-number: QTBUG-136031 Pick-to: 6.5 6.8 6.9 Change-Id: Ia8e37e3810ab3e94a17bab6d40087e521f1abde0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix broken hover in ApplicationWindow's backgroundMitch Curtis2025-04-232-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 8fb643f6d63813a5a8df5e829e4ddeb357e0348d fixed ComboBox not being hoverable by setting QQuickApplicationWindowPrivate::control's hoverEnabled property to true. By doing so, it ensured that only that control and its parent chain could get hover events, breaking hover for e.g. background. The correct fix is to adapt QQuickControlPrivate::calcHoverEnabled to skip the property("hoverEnabled") == true check for QQuickApplicationWindowPrivate::control, resulting in it falling back to the global checks. - Remove code added in 8fb643f6d63813a5a8df5e829e4ddeb357e0348d. - Move QQuickApplicationWindowPrivate declaration into its own header so that code outside the .cpp file (qquickcontrol.cpp, in this case) can use it. - Document behavior of hover flags in void QQuickItem::setAcceptHoverEvents. - Move the check done in tst_QQuickControl::hoverEnabledDefault() into the new tst_QQuickApplicationWindow::hoverInBackground() since they're closely related. - Add initial starting position argument to PointLerper's constructor since it wasn't previously possible to set it. - Remove unused headers in qquickapplicationwindow.cpp. Fixes: QTBUG-133886 Fixes: QTBUG-136031 Pick-to: 6.9 Change-Id: Ic32f902be6433c1c9dc9f4610c5715ce1537e605 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Port away from QPairZhao Yuhang2025-04-122-18/+18
| | | | | | | | 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>
* Move duplicate mouse hover checks into a skip macroMitch Curtis2024-11-221-0/+7
| | | | | | | | | | Similar to 8d454b26263e5333d8475bbab91d7b3d1d5e04d8 and f7dffe0ae8a97dd3d7bbcf753d122b2066639fc3. Pick-to: 6.5 6.8 Change-Id: Iaf9a4edc8a3c37f232ad3b66923864f4baa02d4d Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQuickVisualTestUtils::compareImages: save images on all failuresMitch Curtis2024-11-151-27/+37
| | | | | | | | | | | | I didn't save images on failure for size and format mismatches because I thought it wouldn't be useful, but it turns out it is. Move the image-saving code into a lambda and call it for all failures. Amends 426555aa581ce688538975176cf1c31f6ffddb24. Change-Id: I6b2ccd8fd0a2559c88a8c525e6cd4bad1946e651 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* QQuickVisualTestUtils::compareImages: fail if image depth is not 32Mitch Curtis2024-11-151-0/+4
| | | | | | | | | | | | | | | The function would ignore the depth and read memory that it shouldn't, which can cause hard-to-diagnose failures, and heap-buffer-overflows when ASAN is enabled. Mismatches in depth can happen when optimizing images with optipng, for example, which may convert color images to grayscale. compareImages was added in 7ffea4048321b86402a9ded5255ad16ac74d0518. Pick-to: 6.5 6.8 Change-Id: Id83dcd79ae94088996ff770d90b2c1add910fb1b Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Add missing includesFabian Kosmale2024-10-242-0/+2
| | | | | | | | | | ...in preparation of trimming down includes in QQuickItem. As a drive-by, remove the superfluous qqml.h include from quick/items/qquicktextutil_p.h. Change-Id: I7ee0f459bcbfdfe07314d1f63433aaa8639870ac Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Share code between QQuickViewTestUtils and QQuickVisualTestUtilsTor Arne Vestbø2024-09-273-7/+5
| | | | | | | | 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>
* Remove unused QQUICK_VERIFY_POLISH macroMitch Curtis2024-09-051-3/+0
| | | | | Change-Id: Ib8a402acc5eaf098f1d88a84a6c5c93010f6291f Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Wrap SKIP_IF_NO_* macros in do while(false) loopMitch Curtis2024-09-051-4/+8
| | | | | | | | | | | This prevents errors in certain usages of the macros. https://wiki.qt.io/Things_To_Look_Out_For_In_Reviews#Macros Amends f7dffe0ae8a97dd3d7bbcf753d122b2066639fc3. Change-Id: I0804d439f7019870f9750444316f3cc676e02405 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Move duplicate window grab checks into a skip macroMitch Curtis2024-09-041-0/+4
| | | | | | | | | | Similar to 8d454b26263e5333d8475bbab91d7b3d1d5e04d8. According to b1d0136192b7451788dee79c865dede02438f96e, the offscreen platform now supports window grabs, so remove that from the check. Change-Id: I84b6056f9c96c2fbbda117b18cdef6f8063205ac Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQuickVisualTestUtils::compareImages: improve saved image path outputMitch Curtis2024-09-041-1/+1
| | | | | | | | | | Don't double-quote the string, as it makes it harder to copy. Calling noquote() also removes the double backslashes on Windows. Amends 426555aa581ce688538975176cf1c31f6ffddb24. Change-Id: Ieca0f493f42344d3e16a756037db8777414a4606 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix two compile warnings/errorsMatthias Rauter2024-08-161-2/+3
| | | | | | | | | | | On MSVC the implicit construction of QString from char* and the operator+ of char* and QString triggered warnings that were interpreted as errors. This patch works around those warnings. Amends 426555aa581ce688538975176cf1c31f6ffddb24. Pick-to: 6.5 6.7 6.8 Change-Id: Iae02b4e2b2eb0064446245a78ca294e618a4acb1 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QQuickVisualTestUtils::compareImages: save images on failureMitch Curtis2024-08-091-1/+31
| | | | | | | | | Add a qt.quicktestutils.compareimages logging category which saves compared images to the test executable's directory on failure when its debug category is enabled. Change-Id: Ifb5e85d00768fd11336d986a20080e1c16ca78a2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQuickVisualTestUtils::compareImages: actually check all colorsMitch Curtis2024-08-091-2/+2
| | | | | | | | | | | The function was added in 906d5c5c40183468f9521277c6244a6c46730de6. The tests there don't only use red, so it looks like this bug has existed since 2013. Pick-to: 6.5 6.7 6.8 Change-Id: I4bdf87fe6be0224016baf9a2a80faee6fe61514e Reviewed-by: JiDe Zhang <zhangjide@uniontech.com> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Replace mouse-only flick, moveAndPress, moveAndRelease in testsShawn Rutledge2024-07-022-44/+62
| | | | | | | | | | | 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>
* Move duplicate WindowActivation checks into a skip macroMitch Curtis2024-05-151-0/+6
| | | | | | | | Task-number: QTBUG-124230 Pick-to: 6.5 6.7 Change-Id: I617f851cd2b2b1a4f4c3dada2e4ebdf5c4be18fd Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* Correct license for test filesLucie Gérard2024-04-116-6/+6
| | | | | | | | | | | | | 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>
* quicktestutils: document isDelegateVisibleMitch Curtis2024-03-211-0/+6
| | | | | | Pick-to: 6.5 6.6 6.7 Change-Id: I63c5d453a52df49ef0ce4a4d49c23ad5fe682824 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* quicktestutils: rename delegateVisible to isDelegateVisibleMitch Curtis2024-03-212-2/+2
| | | | | | | | Because it's the convention. Pick-to: 6.5 6.6 6.7 Change-Id: I1d3d53f5c051ede0b011c1daa9d1019cad8875f8 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix ubsan build of qtdeclarativeAllan Sandfeld Jensen2024-02-062-2/+2
| | | | | | | | | | 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>
* Include what you need: <QPointer>Marc Mutz2023-10-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | | All these TUs relied on transitive includes of qpointer.h, maybe to a large extent via qevent.h, though, given that qevent.h is more or less the only public QtBase header that includes qpointer.h, something else seems to be at play here. Said qevent.h actually needs QPointer in-name-only, so a forward declaration would suffice. Prepare for qevent.h dropping the include. The algorithm I used was: If the TU mentions 'passiveGrabbers', the name of the QEvent function that returns QPointers, and the TU doesn't have qpointer.h included explicitly, include it. That may produce False Positives, but better safe than sorry. Otherwise, in src/, add an include to all source and header files which mention QPointer. Exception: if foo.h of a foo.cpp already includes it, don't include again. Task-number: QTBUG-117670 Change-Id: I9b98cda524a0e6a61be7805edda708916bb2bc2b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add PointLerper to QQuickVisualTestUtilsMitch Curtis2023-06-272-0/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a convenience class to linearly interpolate between two move points: PointLerper pointLerper(window); // Lerps from {0, 0} to {15, 15}. pointLerper.move(15, 15); QVERIFY(parentButton->isHovered()); // Lerps from {15, 15} to {25, 25}. pointLerper.move(25, 25); QVERIFY(childButton->isHovered()); This allows testing mouse interaction in a more realistic manner, as opposed to immediately moving to a new position with no intermediate move events. More importantly, it fixes flakiness in tst_qquickpopup hover tests. Includes an attempt to stabilize tst_QQuickDrawer::multiple() which seems to crash due to events arriving after window destruction. Task-number: QTBUG-114718 Pick-to: 6.5 6.6 Change-Id: I4b466d820cec4113a9d266685c4575a3692e5202 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Fix build with -no-feature-listview and itemviewsTasuku Suzuki2023-04-134-0/+14
| | | | | | | | | | | | | 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 coordinate-mapping convenience functions to QQuickVisualTestUtilsMitch Curtis2023-03-312-0/+19
| | | | | | | | | | These make it more convenient to map relative coordinates to the window coordinates expected by QTest functions. Pick-to: 6.5 Change-Id: Ib931af8bda3510209e5ef833e22a0ed3272dde59 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Oliver Eftevaag <oliver.eftevaag@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-202-0/+98
| | | | | | | | | | | | | | | | | | | 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-073-20/+20
| | | | | | | | | | | | | | | | | | | | 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>
* Remove Qt key words from header filesYuhang Zhao2022-07-192-2/+2
| | | | | | | | | | | So that users can use QT_NO_KEYWORDS when linking against QtDeclarative, even if they are using private headers. Docs, examples and tools are not touched because it's not necessary. Pick-to: 6.4 Change-Id: Idc30797074aaa72576429ebdaaf915d7f5acf84e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Remove flushFrameSynchronousEvents from qquickwindow_p.hJohan Solbakken2022-07-171-1/+1
| | | | | | Change-Id: Ib1ae19eac2a5a95b71345b80075f871ea82fa928 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* findItem: don't return items with invalid QQmlContextsMitch Curtis2022-06-161-1/+4
| | | | | | | | | This can cause flakiness in tests. Fixes: QTBUG-75109 Pick-to: 6.2 6.3 6.4 Change-Id: I07c2a4d86076fe8b07df9425660542babbda2c1a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQuickApplicationHelper: move initialProperties before qmlImportPathsMitch Curtis2022-06-152-3/+4
| | | | | | | | | | | 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>
* quicktestutils: remove duplicated function declarationMitch Curtis2022-06-131-2/+0
| | | | | | Pick-to: 6.2 6.3 6.4 Change-Id: If3fc379cbc9517470ce0726671e2451c38204da9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* quick/controlstestutils: add [[nodiscard]] to functions returning stuffMitch Curtis2022-06-132-6/+8
| | | | | | | | 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-116-162/+12
| | | | | | | | | | | | 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>
* QtQuickTest: add API for checking for polish at window levelMitch Curtis2022-06-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Replace uses of deprecated _qs with _s/QStringLiteralSona Kurazyan2022-04-291-1/+3
| | | | | | Task-number: QTBUG-101408 Change-Id: Ic925751b73f52d8fa5add5cacc52d6dd6ea2dc27 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QuickTestUtilsPrivate: includemocsMarc Mutz2022-04-293-0/+6
| | | | | | | | | | | | 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>
* Make sure all private headers include at least one otherThiago Macieira2022-03-102-0/+2
| | | | | | | | | | See script in qtbase/util/includeprivate for the rules. Since these files are being touched anyway, I also ran the updatecopyright.pl script too. Change-Id: Ib056b47dde3341ef9a52ffff13ef677e471674b6 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Replace 0 pointer constants with nullptrAllan Sandfeld Jensen2021-10-181-1/+1
| | | | | | | Replaced in most common patterns. Change-Id: Idcaff1f2e915f29922702d3600a2e5f1e2418a7a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix codechecker complaint about QString from string literal constructionFabian Kosmale2021-09-171-1/+1
| | | | | | | | This addresses the codechecker issue with hash 9244a63961d4d2bede8fc8dc2972e65b. Change-Id: Id2781610e8a7566de66a099d302220bee1db5896 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Consolidate test helpers into private librariesMitch Curtis2021-09-136-0/+1302
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>