diff options
author | Joni Poikelin <joni.poikelin@qt.io> | 2021-04-16 15:24:29 +0300 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2021-09-29 13:39:41 +0200 |
commit | d9f9d773e92940786f159897623618f3bf6bcf0f (patch) | |
tree | 3e1dd54045b237d18bcbb870d74aff5cd68f9383 /tests/auto/quick/qquicklistview/tst_qquicklistview.cpp | |
parent | f75faaf4d2e9d6fb5bbf7212df62cb0783246f45 (diff) |
Fix ListView.isCurrentItem when used with DelegateModel
Fixes: QTBUG-86744
Pick-to: 5.15 6.1 6.2
Change-Id: I7287b39afc8f84e336aa46739b534e33e4212ea7
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests/auto/quick/qquicklistview/tst_qquicklistview.cpp')
-rw-r--r-- | tests/auto/quick/qquicklistview/tst_qquicklistview.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 6975fa2dbd..ac22a51a59 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -303,6 +303,7 @@ private slots: void requiredObjectListModel(); void clickHeaderAndFooterWhenClip(); void animatedDelegate(); + void isCurrentItem_DelegateModel(); // WARNING: please add new tests to tst_qquicklistview2; this file is too slow to work with. @@ -10124,6 +10125,20 @@ void tst_QQuickListView::animatedDelegate() } } +void tst_QQuickListView::isCurrentItem_DelegateModel() +{ + QScopedPointer<QQuickView> window(createView()); + window->setSource(testFileUrl("qtbug86744.qml")); + window->resize(640, 480); + window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); + + QQuickListView* listView = window->rootObject()->findChild<QQuickListView*>("listView"); + QVERIFY(listView); + QVariant value = listView->itemAtIndex(1)->property("isCurrent"); + QVERIFY(value.toBool() == true); +} + // WARNING: please add new tests to tst_qquicklistview2; this file is too slow to work with. QTEST_MAIN(tst_QQuickListView) |