diff options
author | Martin Jones <martin.jones@nokia.com> | 2011-05-13 05:28:30 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2011-05-13 05:28:30 (GMT) |
commit | 576d577438f1193bbc934e904b809d5b23b8d54e (patch) | |
tree | 900f0de9c10ed59b48f1eab73de1447615d49630 /tests | |
parent | f69e465e15930ef02dceba7175eed6f3f1df070e (diff) | |
download | Qt-576d577438f1193bbc934e904b809d5b23b8d54e.zip Qt-576d577438f1193bbc934e904b809d5b23b8d54e.tar.gz Qt-576d577438f1193bbc934e904b809d5b23b8d54e.tar.bz2 |
ListViews loses items if all visible items are removed.
Occurs when at end of list and all visible items are removed in
multiple steps, without entering the event loop.
We were not updating visibleIndex if there were no visible items
when handling itemsRemoved().
Also avoid skipping items in refill if there are no valid visible
items for reference.
Change-Id: I2ff58fb191f6b053f33d5446220d597eb15b66d4
Task-number: QTBUG-19198
Reviewed-by: Bea Lam
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 8b90030..23ac523 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -714,6 +714,16 @@ void tst_QDeclarativeListView::removed(bool animated) QTRY_VERIFY(name = findItem<QDeclarativeText>(contentItem, "textName", model.count()-1)); QCOMPARE(name->text(), QString("New")); + // Add some more items so that we don't run out + for (int i = 50; i < 100; i++) + model.addItem("Item" + QString::number(i), ""); + + // QTBUG-19198 move to end and remove all visible items one at a time. + listview->positionViewAtEnd(); + for (int i = 0; i < 18; ++i) + model.removeItems(model.count() - 1, 1); + QTRY_VERIFY(findItems<QDeclarativeItem>(contentItem, "wrapper").count() > 16); + delete canvas; } |