aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklistview
Commit message (Collapse)AuthorAgeFilesLines
* Fix positionViewAtBeginning() when item 0 is outside the cache bufferMorten Sørvig2026-04-282-0/+131
| | | | | | | | | | | | | | | | | | | | positionAt(0) can make inaccurate estimates in cases where the target element is outside the cache buffer, and the list contains section headers. However, since the beginning is a well-known position we can just scroll directly to that position instead. If we do, markExtentsDirty after clearing the visibleItems, to prevent an issue that could occur when setPosition(0) gets called with a stale extent. the extent must be recalculated, in order to be precise, and take into account if the first item has a section or not. Fixes: QTBUG-132694 Pick-to: 6.11 Change-Id: I51e0634e685d56d1ab341c31f79a8e89cfa6f5c0 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Remove redundant calls to requestActivate in tst_QQuickListViewFrédéric Lefebvre2026-03-091-1/+0
| | | | | | | | | | | | | tst_QQuickListView include calls to requestActivate() after a window is shown. This call is superfluous for the current test and should be removed. Remove the unnecessary requestActivate() calls to simplify the code. Task-number: QTBUG-139705 Pick-to: 6.11 6.10 Change-Id: I30a867bb7acd704605c69ceb87b6defad82daadd Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tests: Blacklist more tests on WaylandEskil Abrahamsen Blomfeldt2026-03-051-0/+20
| | | | | | | | | In order to get blocking tests running, we blacklist anything that currently fails. Pick-to: 6.11 Change-Id: Ifb36134709eeb5c8f98c90f96728020528b82153 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QQmlPropertyCache expand Override Semantics. MetaObject pathDmitrii Akshintsev2026-02-041-1/+1
| | | | | | | | | | | | | | This commit enables expanded Override Semantics for the properties added from the MetaObject path. It also introduces logging categories, so some of them could be silenced when they are not actionable for the user Task-number: QTBUG-98320 Change-Id: Ifb414ab795bc78f23a151666bb0d8af9b7a18d76 Pick-to: 6.11 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQmlPropertyCache expand Override Semantics. QML pathDmitrii Akshintsev2025-12-051-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This path focuses on the actual expansion of Override Semantics with regard to newly added virtual and override keywords. Since Override Semantics is central to the way PropertyCache is being populated, expanding it requires additional care. To ensure smooth and reliable iteration, this patch isolates data-flows: within this patch adding properties from MetaObject stay "unaffected" by the expansion, as well as the paths adding Methods and Signals from the IR. This is done with the help of 3 things: 1. Separating logging logic from the Override logic 2. Extracting Override Semantics into it's own namespace 3. Adding a nob to control the set of rules To facilitate and separate testing of the logging logic and override semantics, the principle of dependency injection is being used, allowing us to easily Fake handling of override semantics, simplifying testing of PropertyCache::appendPropertyAttr Logging logic (messages) is kept on the side of QQmlPropertyCache mostly because this entity logically has more context to do proper logging. Taking into account how the class name and name of the property are handled, those are kept to be "requested on demand", a.k.a. query them only in cases when the logging indeed needs to be performed. Multiple append* methods have been moved to the private section to avoid invalidation of caches. See comment above QQmlPropertyCache. As a workaround to enable unit-testing of some methods, tst_qqmlpropertycache has been added as a friend class. This patch updates tests/auto/quick/qquicklistview/data/negativeDisplayMargin.qml to remove an unintended override of ListView’s built-in count property. The test declared its own count property, which implicitly shadowed ListView.count. The newly introduced validation correctly flagged this conflict, so the test has been adjusted accordingly. Change-Id: I809e58e421fa50f5ee7f21b31edbf926ad472736 Task-number: QTBUG-98320 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Release section item when the corresponding view item removedSanthosh Kumar2025-09-122-0/+114
| | | | | | | | | | | | | | | | | | | | | | | The section item has not been removed or added to the section cache in all cases when the corresponding delegate item has been moved out of the visible area, either during flick or scroll. This happens in a case where the delegate item has been requested to be removed (as it goes out of the visible area) from the list view, but it's not released from the delegate model due to its caching mechanism. When an item is outside the visible area, releaseItem() is triggered, intended to free the item and its sections. The problem arises when releaseItem() calls QQmlInstanceModel::release(), which caches the item in the delegate model, but does not free the section. This prevents the section item from being released properly. This patch releases the section item whenever removeItem is triggered from the list view, which happens when the delegate item is moved out of the visible area. Fixes: QTBUG-137172 Pick-to: 6.10 6.9 6.8 6.5 Change-Id: Ib7e78309e076e76750b03f3238a7501563a3962a Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* QQmlDataTest: drop default try timeout from 5 seconds to 1Mitch Curtis2025-08-071-1/+1
| | | | | | | | | | | | Make debugging of failing tests less painful. The tests that had to be changed as a result are listed in the comments of the linked task. Fixes: QTBUG-138662 Task-number: QTBUG-81979 Change-Id: Iee50f2d4f2160e3e9bc2c7985925583fad810811 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* tests: do not leak QPointingDevice instancesShawn Rutledge2025-05-101-7/+6
| | | | | | | | | QTest::createTouchDevice() passes ownership of the device to the caller, so make sure it gets deleted. Pick-to: 6.8 6.9 Change-Id: I1289def6b40bf688a7334b9997f7e4319516d018 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Unblacklist tst_qquicklistview::populateTransitions on openSUSEFrédéric Lefebvre2025-05-081-3/+0
| | | | | | | | | | | | tst_qquicklistview::populeTransitions was blacklisted on openSUSE-42.1, which has been deprecated. This test is not flaky on openSUSE 15 Fixes: QTBUG-53863 Pick-to: 6.9 6.8 6.5 Change-Id: I88c26d9450f9563f0e83c60f052b3f4f696efd21 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QQuickTest: add and use active focus macrosMitch Curtis2025-04-251-2/+2
| | | | | | | | | | | | | Also add support for popups (when controlstestutils_p.h is included). [ChangeLog][Qt Quick Test] Added QVERIFY_ACTIVE_FOCUS and QTRY_VERIFY_ACTIVE_FOCUS macros that can be used to get detailed failure messages for when QQuickItem::hasActiveFocus should be true but isn't. Task-number: QTBUG-133858 Change-Id: I30c67a84ccc16e3969bac5661648d0062bc3d62c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Tests: include QTest, not QtTestGiuseppe D'Angelo2025-04-151-1/+1
| | | | | | | | | | | | | Never use module-wide inclusions. They blow up build times. For QtTest this is usually just a typo (QTest was meant instead). Add missing includes as needed. In the diffs I've spotted other huge inclusions (QtQuick, QtQml), but those need more attention. Task-number: QTQAINFRA-7110 Pick-to: 6.9 6.8 Change-Id: I74bf3fe212f50a7a3a6af2b1c80bbcaabc2516d7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Port away from QPairZhao Yuhang2025-04-123-26/+26
| | | | | | | | QPair is just an alias of std::pair anyway. Task-number: QTBUG-115841 Change-Id: I26fc90adcc775aac9955ad57304af914dc4ed48f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix flakiness tst_QQuickListView::enforceRange_withoutHighlightFrédéric Lefebvre2025-03-252-3/+1
| | | | | | | | | | | | | | tst_QQuickListView::enforceRange_withoutHighlight is flaky where a key press is not received when the window is not active yet and fails. Verify that the window is active before sending the keypress event. Unblacklist tst_QQuickListView::enforceRange_withoutHighlight on Opensuse as it is no longer flaky. Pick-to: 6.9 6.8 6.5 Change-Id: Ib1013a73d9267354f7d045345bac74125366ff03 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tests/: more const containers instead of std::as_const()Ahmad Samir2025-01-071-10/+14
| | | | | | | | | | | | | | - Where the data is known at compile time, use C arrays - Initialize QStringList with initializer_list instead of the operator<<() style - Make QPoint/F for-loop variables values, their sizes are two ints and two doubles, respectively - std::array isn't a Qt container, so std::as_const is redundant, no detach possible Task-number: QTBUG-115808 Change-Id: I995c98bc4f35907704b6e64786a90cf8375575f0 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Move DelegateChooser from Qt.labs.models to QtQml.ModelsOliver Eftevaag2024-11-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | I assume the intention was to eventually move it out of Qt.labs.models, once we've had a second look at the API, and are happy enough with it. The DelegateChooser uses the adaptor model's `value` function, to fetch data from the model, which it then uses for finding a suitable DelegateChoice to use. (Based on the DelegateChoice::roleValue property). Since the adaptor model's `value` function takes a QString, as the role to read data from, it won't make sense to change the datatype of DelegateChooser::role. The rest of the API makes sense too, in my opinion, and I see no reason to change it. Add a simple test in tst_qqmldelegatemodel, since QQmlDelegateModel is using the DelegateChooser in QQmlDelegateModelPrivate::resolveDelegate. [ChangeLog][QtQmlModels][Important Behavior Change] DelegateChooser has been moved from Qt.labs.models to QtQml.Models. Fixes: QTBUG-98101 Task-number: QTBUG-100069 Change-Id: I76ea58f57475b6a069517b5030e2ba3ac47007d2 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add Qt::Qml before Qt::QmlPrivate to auto testsKarim Pinter2024-10-221-0/+1
| | | | | | | | | | The build for auto tests for VxWorks fails because Qt::Qml is not added before Qt::QmlPrivate resulting in many unresolved symbols from Qt::Qml library. When Qt::Qml is added before it solves this problem. Task-number: QTBUG-129113 Change-Id: I89d553ac1d6706e2e934665fed2f308e6b01ed78 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Container: cull items when our size is zero and contentItem is a viewMitch Curtis2024-08-191-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The typical use case for SwipeView is that the user declares items directly as children. Those children are added to its QQmlObjectModel, which are then used as the delegates for its ListView. ListView culls the items it manages, but in the case of a zero-sized view, those that are outside the view - and hence not in its visibleItems list - are not its responsibility. That responsibility instead falls to QQuickContainer. It's also necessary to clear and return early in QQuickItemViewPrivate::layout if the size of the view is zero, otherwise the tests that check if a valid-sized view is made zero-sized fail. Add a new C++-based test for Container which is only run with the Basic style (similar to e.g. tst_qquickmenubar) so that we can check the culled member of QQuickItemPrivate. tst_container.qml is run with all styles (even though it probably doesn't need to be, but it would also be difficult to rewrite in C++, even though it's fairly small). Fix some tests that were using zero-sized views. Fixes: QTBUG-125416 Pick-to: 6.5 6.7 6.8 Change-Id: Ia05791b69568d51bea310e4f09266645ca2f1829 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Replace mouse-only flick, moveAndPress, moveAndRelease in testsShawn Rutledge2024-07-021-23/+36
| | | | | | | | | | | 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>
* Avoid infinite loop in ListView/GridView snapOne/snapTo testsShawn Rutledge2024-07-021-14/+36
| | | | | | | | | | | | | | | | | | | I'm not sure if any actual CI failures resulted from failure to terminate the do..while loops, but it seems likely, since a recent patch seems to provoke that. It's better to fail after a reasonable number of loops, rather than letting it go and hoping for a timeout. In practice it seems 2 rounds is enough, so let's try 4 as the limit. While we're at it, round the grid.contentX/contentY values that are displayed. Intermediate values have always been shown with way too many decimal places, which interfered with whatever value it has to display the numbers. Pick-to: 6.8 Task-number: QTBUG-33017 Task-number: QTBUG-88644 Change-Id: I2fc4843071276b3af544c2506eb152698542cd06 Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* Call QQuickItem::mouseUngrabEvent() on ungrab from QTabletEventShawn Rutledge2024-06-282-0/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix flaky test tst_qquicklistview::multipleTransitionsJan Arve Sæther2024-06-282-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test assumed that an item inserted in the beginning of the ListView will always end up at position 0 (x or y). This is wrong assumption, since the ListView can choose to put the new items above/left of the existing items without having to adjust the coordinates of all of the existing items, and then accordingly it will adjust the origin(X,Y), ensuring that the visual rendering will be the same for both cases. The documentation of Flickable::originY explicitly mentions this (https://doc.qt.io/qt-6/qml-qtquick-flickable.html#originY-prop): "originY : real [...] This is usually (0,0), however ListView and GridView may have an arbitrary origin due to delegate size variation, or item insertion/removal outside the visible region." This can also be reproduced without any transitions, so assuming that the y coordinate of the first item is always 0 should therefore strictly not be part of a test intended for transitions. Pick-to: 6.7 6.8 Fixes: QTBUG-123894 Change-Id: Idc63cd385ed62936d9e45e31fcf3f725ee4405c4 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* ListView: take section size into account while snapping an item into placeIvan Solovev2024-06-272-0/+74
| | | | | | | | | | | | | | | | In case the sections are displayed using ViewSection.CurrentLabelAtStart, the section size should be taken into account while snapping the items. This patch extends the fixup() method to perform such checks. The drawback of this approach is that the position adjustment takes some time (because of the animation) and happens after the scrolling is finished. A better solution would be to fix the scrolling process in such a way, that no adjustment is needed during fixup. Fixes: QTBUG-30768 Pick-to: 6.8 6.7 6.5 6.2 Change-Id: I31a1a3af55afe8be4e8d7980cbb163622e3283bc Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Blacklist tst_qquicklistview::multipleTransitions() on macosUlf Hermann2024-06-111-0/+4
| | | | | | Task-number: QTBUG-123894 Change-Id: I86cb695ac1c2d509bc17070811848bc901faf36a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Replace all occurrences of Q_OS_MAC with more appropriate definesTor Arne Vestbø2024-06-041-1/+1
| | | | | | Pick-to: 6.8 Change-Id: I6ea24d0439c78efbb1df242fb980d3d8b084eeb2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* quicktestutils: rename delegateVisible to isDelegateVisibleMitch Curtis2024-03-211-67/+67
| | | | | | | | Because it's the convention. Pick-to: 6.5 6.6 6.7 Change-Id: I1d3d53f5c051ede0b011c1daa9d1019cad8875f8 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Correct license for test filesLucie Gérard2024-02-2727-27/+27
| | | | | | | | | | | | | | 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 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I26d72e8de04d4c7c57b3b7838af5d033265de5ba Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Kai Köhne <kai.koehne@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Remove remaining foreach in quick testsUlf Hermann2023-08-232-12/+9
| | | | | | | Task-number: QTBUG-115808 Change-Id: I30c27cf9972257897f15d57d62ff05ad1028b35e Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Mark the module as free of Q_FOREACH, except where it isn'tMarc Mutz2023-08-172-0/+4
| | | | | | | | | | | | | | | | | | | The density of Q_FOREACH uses is high here, too high for this author, unfamiliar with this code, to tackle in a short amount of time. But they're concentrated in just a few TUs, so pick a different strategy: Mark the whole module with QT_NO_FOREACH, to prevent new uses from creeping in, and whitelist the affected TUs by #undef'ing QT_NO_FOREACH locally, at the top of each file. For TUs that are part of a larger executable, this requires these files to be compiled separately, so add them to NO_PCH_SOURCES (which implies NO_UNITY_BUILD_SOURCES, too). Created QTBUG-115808 to keep track of this. Task-number: QTBUG-115808 Change-Id: I29c377f939e3d747e3ce72c224c4ee722df7a95d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Make quick tests standalone projectsAlexandru Croitor2023-07-051-0/+6
| | | | | | | | | | | | | | | | | Add the boilerplate standalone test prelude to each test, so that they can be opened with an IDE without the qt-cmake-standalone-test script, but directly with qt-cmake or cmake. Boilerplate was added using the follow script: https://git.qt.io/alcroito/cmake_refactor Manual adjustments were made where the code was inserted in the wrong location. Task-number: QTBUG-93020 Change-Id: I7854e7f015535a4835ce3daf816f7f33aa242c2a Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QQuickItemView: Skip instantiating delegates if size is 0Fabian Kosmale2023-04-202-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If the area of a (List|Grid)View is 0, then instantiating delegates is pointless, as they couldn't be shown anyway. However, our current logic could not handle this case well, and would end up instantiating a delegate for every delegate entry if their size also ended up being 0 - you can after all fit infinitely many 0 sized items into a zero sized container. Detect this situation in QQuickItemViewPrivate::refill and the applyInsertionChange implementations. Note that we only exit early if there are no visible items and the view is zero-sized; if there are visible items, we still want to ensure that they are removed after all. We also need to adjust a few tests which had zero sized views to no longer be zero sized; otherwise they wouldn't have created their delegates in time. [ChangeLog][QtQuick][ListView][Important Behavior Change] If a ListView has size zero, it won't instantiate any delegates until its size becomes non-zero. Pick-to: 6.5 Fixes: QTBUG-110625 Fixes: QTBUG-89568 Fixes: QTBUG-51773 Change-Id: Ibe0e6fa5f01784016882522c120d2fee38df285b Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Quick item view tests: fix compile warningVolker Hilsheimer2023-04-181-1/+1
| | | | | | | | | | | Don't use QCOMPARE for a true/false test, use QVERIFY. This conveniently fixes the (bogus, perhaps) compiler warning with MSVC about comparing a quint32 (the underlying type of the polishScheduled bitfield) with a bool. Pick-to: 6.5 Change-Id: Ib273ee30906e09955e849e65af2b7ff8ce3e2512 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix content position of list viewSanthosh Kumar2023-03-032-0/+66
| | | | | | | | | | | | | | | The content position of list view is incorrect, if populate animation is configured with BottomToTop or RightToLeft layout direction. This is because, we are not setting internal position for first item in the list view. This patch will set correct internal postion to the first item in list view. Fixes: QTBUG-111050 Change-Id: I1a233a938e2c088d176d79871a08bcd2a8edd6b3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QQuickMouseArea: do not overload pressed-signalSami Shalayel2023-01-241-1/+1
| | | | | | | | | | | Renames the pressed() getter of the pressed property in QQuickMouseArea to isPressed() to avoid overloading the pressed()-signal. Signals should not be overloaded. Also, it makes code generation in qmltc more complicated. Task-number: QTBUG-110029 Change-Id: I2373f4fe97b1e955b815825003bc746f2eaf43be Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Retire the qt_parse_all_argumentsAmir Masoud Abdol2023-01-201-2/+2
| | | | | | Task-number: QTBUG-99238 Change-Id: Ia11c9cbd7c06347319ab3674ec0cd8da0214747e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* tst_QQuickListView::QTBUG_38209: QTRY_COMPARE_GE instead of QTRY_VERIFYShawn Rutledge2023-01-111-1/+1
| | | | | | | | | | We need to see the values when it fails. It turns out that the movement can be exactly 100 on macOS, and that's also "more than just a couple pixels" so it should be ok. Pick-to: 6.5 Change-Id: I4dcdf647886dd5dcc7267a32b1dd9858fdccf64d Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* tst_QQuickListView::flickBothDirections: flick moreShawn Rutledge2023-01-051-1/+1
| | | | | | | | | | | | | | | If we make flickDeceleration's default value platform-dependent and often larger, this test begins failing because it expects to flick all the way to the end of the ListView. If we flick a longer distance (starting at the lower-right instead of in the middle of the ListView) in the same time, it's more likely to get to the end. An alternative would be to set flickDeceleration back to the old value in this test. Pick-to: 6.5 Change-Id: If85d9502ceef9fbf6fc087240572cc98326453a5 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQuickItemView: Fix max(X/Y)Extent()David Redondo2022-11-221-8/+6
| | | | | | | | | | | | | | QQuickFlickable maxXExtent() and maxYExtent() return the amount of space that is not shown when inside a ScrollView. QQuickItemView however just returned width() if vertical and height() if horizontal. In these cases just defer to the QQuickFlickable base implementation like minXExtent() and minYExtent() already do. Fixes: QTBUG-83890 Pick-to: 6.2 6.4 Change-Id: I7f4060c2f46ae07611bedceca0d322c5f7f6affb Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Port from container::count() and length() to size() - V5Marc Mutz2022-10-131-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); except that on() was replaced with a matcher that doesn't ignoreParens(). a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'. Change-Id: I58e1b41b91c34d2e860dbb5847b3752edbfc6fc9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-071-4/+4
| | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: I601bf70f020f511019ed28731ba53b14b765dbf0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Port from container::count() and length() to size()Marc Mutz2022-10-073-141/+141
| | | | | | | | | | | | | | | | | | | | 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>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-09-071-1/+1
| | | | | | | Task-number: QTBUG-105718 Change-Id: Id89ed14990804a5024183e75382cc539d4293da1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* tst_qquicklistview: remove some bindings to parentMitch Curtis2022-08-258-8/+13
| | | | | | | | See ed73efa27acd8e7c42a960ef90c2e4a898c20c30. Pick-to: 6.2 6.3 6.4 Change-Id: I32434afcfd5faaf1c05b50cd96dfe6e6468f3ac4 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* CMake: Don't use PUBLIC_LIBRARIES for tests and test helpersAlexandru Croitor2022-07-281-1/+1
| | | | | Change-Id: I1cd769f85d5f82c43639d6787d98e536619249e6 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Add license headers to cmake filesLucie Gérard2022-07-081-0/+3
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I72c89a98c42bbc9234d8495e9e503bec81d11037 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* tst_qquicklistview: fail on warningsMitch Curtis2022-07-057-28/+58
| | | | | | | Task-number: QTBUG-98718 Pick-to: 6.2 6.3 6.4 Change-Id: Ia1395236848582681d03f43792ca92ed07db0408 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Add convenience API for making QQmlDataTest-based tests fail on warningsMitch Curtis2022-07-051-1/+3
| | | | | | | | | | | | | | | | | | | | After this patch, if a QQmlDataTest-derived class passes FailOnWarningsPolicy::FailOnWarnings to the base constructor, any non-empty warning encountered by that test will result in a test failure. This avoids the need to duplicate the catch-all regex in tests that want to fail on warnings. The goal is to gradually enable failure-on-warnings over time. Leave comments and explicitly pass DoNotFailOnWarnings for tests that should never fail on warnings. Task-number: QTBUG-98718 Pick-to: 6.2 6.3 6.4 Change-Id: I4b647d93a0f28ac891c4bdb19ef74569f2918e8f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* findItem: don't return items with invalid QQmlContextsMitch Curtis2022-06-161-6/+0
| | | | | | | | | 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>
* Use SPDX license identifiersLucie Gérard2022-06-1127-1048/+54
| | | | | | | | | | | | 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>
* tst_qquicklistview: fix some TypeErrors and ReferenceErrorsMitch Curtis2022-06-103-30/+60
| | | | | | | | | | | | - Ensure that context properties outlive the view. - Ensure that delegates don't unconditionally reference properties of the parent (which may be null). - Add missing TestObject and test model. Task-number: QTBUG-98718 Pick-to: 6.2 6.3 6.4 Change-Id: Icaf3c6824674819c88fc7be51932e6d7e5fb205a Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QtQuickTest: add API for checking for polish at window levelMitch Curtis2022-06-021-126/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>