diff options
| author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2026-09-03 12:35:56 +0300 |
|---|---|---|
| committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2026-09-03 12:35:56 +0300 |
| commit | 7ed17317a5013b1ab885ecc4ac61fb0ed3c1ab35 (patch) | |
| tree | 7c208fe854d7dcfd7421c2ea20e3cd8a0812adfe /tests/auto/quickcontrols/qquickcontainer/tst_qquickcontainer.cpp | |
| parent | 175e30c1a74c2b4efa5a6fe5c45d289660b51d2f (diff) | |
| parent | 2d9e5e76640cd16724ec2fef20d60109537be0bd (diff) | |
Merge tag 'v6.5.10-lts-lgpl' into 6.56.5
Qt 6.5.10-lts-lgpl release
Diffstat (limited to 'tests/auto/quickcontrols/qquickcontainer/tst_qquickcontainer.cpp')
| -rw-r--r-- | tests/auto/quickcontrols/qquickcontainer/tst_qquickcontainer.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/auto/quickcontrols/qquickcontainer/tst_qquickcontainer.cpp b/tests/auto/quickcontrols/qquickcontainer/tst_qquickcontainer.cpp index ce95f2cc37..b61717e4c9 100644 --- a/tests/auto/quickcontrols/qquickcontainer/tst_qquickcontainer.cpp +++ b/tests/auto/quickcontrols/qquickcontainer/tst_qquickcontainer.cpp @@ -8,6 +8,8 @@ #include <QtQuickTestUtils/private/qmlutils_p.h> #include <QtQuickTestUtils/private/visualtestutils_p.h> #include <QtQuickControlsTestUtils/private/controlstestutils_p.h> +#include <QtQuick/private/qquicklistview_p.h> +#include <QtQmlModels/private/qqmlobjectmodel_p.h> using namespace QQuickVisualTestUtils; using namespace QQuickControlsTestUtils; @@ -22,6 +24,7 @@ public: private slots: void zeroSize_data(); void zeroSize(); + void skipReorderContentModelItem(); }; tst_qquickcontainer::tst_qquickcontainer() @@ -102,6 +105,34 @@ void tst_qquickcontainer::zeroSize() QCOMPARE(QQuickItemPrivate::get(text4)->culled, isItemView); } +void tst_qquickcontainer::skipReorderContentModelItem() +{ + QQuickControlsApplicationHelper helper(this, "skipReorderContentModelItem.qml"); + QVERIFY2(helper.ready, helper.failureMessage()); + centerOnScreen(helper.window); + helper.window->show(); + QVERIFY(QTest::qWaitForWindowExposed(helper.window)); + + const auto *container = helper.window->property("navigationBar").value<QQuickContainer *>(); + QVERIFY(container); + const auto *listView = container->property("listView").value<QQuickListView *>(); + QVERIFY(listView); + const auto *contentModel = container->property("contentModel").value<QQmlObjectModel *>(); + QVERIFY(contentModel); + + QCOMPARE(listView->count(), contentModel->count()); + + int totalWidth = listView->spacing() * (contentModel->count() - 1); + for (int index = 0; index < contentModel->count(); index++) + totalWidth += qobject_cast<QQuickText *>(listView->itemAtIndex(index))->width(); + QVERIFY(totalWidth > listView->width()); + + for (int index = 0; index < listView->count(); index++) { + const auto *textItem = qobject_cast<QQuickText *>(listView->itemAtIndex(index)); + QCOMPARE(textItem->text().toInt(), index + 1); + } +} + QTEST_MAIN(tst_qquickcontainer) #include "tst_qquickcontainer.moc" |
