diff options
author | Bea Lam <bea.lam@nokia.com> | 2011-11-10 14:30:08 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-11-16 04:39:26 +0100 |
commit | 80615c3036e689061588a144339125b7fb8e66e5 (patch) | |
tree | 195ce893dd0a15d486550b2a8a08b285b9ec3102 /tests/auto/declarative/qquicklistview/tst_qquicklistview.cpp | |
parent | eef97750eb1c5b33ed8e0e8c0d1bbf6385239701 (diff) |
Fix refill where zero-size items are involved
881091b5c0f1d2ead2b70e54f7ac2e4c17680b4e was incorrect since it meant
that any items following zero-sized delegates would not be deleted as
they scrolled up past the top of the view.
refill() should be deleting these items as well as any zero-sized items
before them.
Task-number: QTBUG-22014
Change-Id: I10cd30bb85a8ec1ddaa2a1cbaa924192536ef6fc
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'tests/auto/declarative/qquicklistview/tst_qquicklistview.cpp')
-rw-r--r-- | tests/auto/declarative/qquicklistview/tst_qquicklistview.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/auto/declarative/qquicklistview/tst_qquicklistview.cpp b/tests/auto/declarative/qquicklistview/tst_qquicklistview.cpp index ae37724492..36824f8e0f 100644 --- a/tests/auto/declarative/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/declarative/qquicklistview/tst_qquicklistview.cpp @@ -3468,7 +3468,7 @@ void tst_QQuickListView::resizeFirstDelegate() // check the content y has not jumped up and down QCOMPARE(listview->contentY(), 0.0); QSignalSpy spy(listview, SIGNAL(contentYChanged())); - QTest::qWait(300); + QTest::qWait(100); QCOMPARE(spy.count(), 0); for (int i = 1; i < model.count(); ++i) { @@ -3477,6 +3477,24 @@ void tst_QQuickListView::resizeFirstDelegate() QTRY_COMPARE(item->y(), (i-1)*20.0); } + + // QTBUG-22014: refill doesn't clear items scrolling off the top of the + // list if they follow a zero-sized delegate + + for (int i = 0; i < 10; i++) + model.addItem("Item" + QString::number(i), ""); + + item = findItem<QQuickItem>(contentItem, "wrapper", 1); + QVERIFY(item); + item->setHeight(0); + + listview->setCurrentIndex(19); + qApp->processEvents(); + + // items 0-3 should have been deleted + for (int i=0; i<4; i++) + QTRY_VERIFY(!findItem<QQuickItem>(contentItem, "wrapper", i)); + delete testObject; delete canvas; } |