diff options
author | Martin Jones <martin.jones@nokia.com> | 2011-01-21 05:03:35 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2011-01-21 05:03:35 (GMT) |
commit | c3dd455b03a6c03011e2446f69fc262230e91639 (patch) | |
tree | 4400e080dc56d85012f063eea7178681eda505b4 /tests | |
parent | 8c3086aa36b51a9731fce8eb8146b33ab8196aed (diff) | |
download | Qt-c3dd455b03a6c03011e2446f69fc262230e91639.zip Qt-c3dd455b03a6c03011e2446f69fc262230e91639.tar.gz Qt-c3dd455b03a6c03011e2446f69fc262230e91639.tar.bz2 |
positionViewAtIndex can fail when positioned near end of list.
We positioned the view beyond the bounds, which in some cases resulted
in only one item being created. Combined with a bug in the bounds
fixup very many items were created.
Task-number: QT-4441
Reviewed-by: Michael Brasser
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index b343010..9b6f04c 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -1329,6 +1329,19 @@ void tst_QDeclarativeListView::positionViewAtIndex() QTRY_COMPARE(item->y(), i*20.); } + // Position at End using last index + listview->positionViewAtIndex(model.count()-1, QDeclarativeListView::End); + QTRY_COMPARE(listview->contentY(), 480.); + + // Confirm items positioned correctly + itemCount = findItems<QDeclarativeItem>(contentItem, "wrapper").count(); + for (int i = 24; i < model.count(); ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(contentItem, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), i*20.); + } + // Position at End listview->positionViewAtIndex(20, QDeclarativeListView::End); QTRY_COMPARE(listview->contentY(), 100.); |