aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2011-05-13 15:28:30 +1000
committerMartin Jones <martin.jones@nokia.com>2011-05-30 15:50:32 +1000
commit44dfcc68efd5d60ea8991b3455c3eec0f2e33773 (patch)
treee34165efb2af02a3a94321234a8f313726ce485e /tests
parentd91e311ab7de4f2ae4ab147e5dbb8d914c5316da (diff)
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 (cherry picked from commit 576d577438f1193bbc934e904b809d5b23b8d54e)
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp10
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 ff471658e0..f7d6dd81f9 100644
--- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
+++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
@@ -717,6 +717,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;
delete testObject;
}