diff options
author | Martin Jones <martin.jones@nokia.com> | 2011-07-28 15:06:02 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-07-28 08:39:33 +0200 |
commit | da0441aa30e1e10c1e0ac9a8cd305c1b6e63c111 (patch) | |
tree | 47ed8dd27a44689c0bfb420950faf1e26fac8dc3 /tests | |
parent | 68ef13d7915fd86164b1819f7adeea22214a41b7 (diff) |
ListView doesn't show new 1st item currentItem is removed.
If the new 1st item becomes the currentItem after removal
it was positioned incorrectly because the currentItem is positioned
based on visibleIndex, which was updated after the currentItem
was updated. Move visibleIndex update before currentItem update.
Change-Id: Iaf92a41eefe7bce093e3000d17f5496dba144bcd
Fixes: QTBUG-20575
Reviewed-on: http://codereview.qt.nokia.com/2316
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Bea Lam <bea.lam@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qsglistview/tst_qsglistview.cpp | 9 | ||||
-rw-r--r-- | tests/auto/qtquick1/qdeclarativelistview/tst_qdeclarativelistview.cpp | 9 |
2 files changed, 16 insertions, 2 deletions
diff --git a/tests/auto/declarative/qsglistview/tst_qsglistview.cpp b/tests/auto/declarative/qsglistview/tst_qsglistview.cpp index c7a68e55cc..43efea268b 100644 --- a/tests/auto/declarative/qsglistview/tst_qsglistview.cpp +++ b/tests/auto/declarative/qsglistview/tst_qsglistview.cpp @@ -788,9 +788,16 @@ void tst_QSGListView::removed(bool animated) QCOMPARE(name->text(), QString("New")); // Add some more items so that we don't run out - for (int i = 50; i < 100; i++) + model.clear(); + for (int i = 0; i < 50; i++) model.addItem("Item" + QString::number(i), ""); + // QTBUG-QTBUG-20575 + listview->setCurrentIndex(0); + listview->setContentY(30); + model.removeItem(0); + QTRY_VERIFY(name = findItem<QSGText>(contentItem, "textName", 0)); + // QTBUG-19198 move to end and remove all visible items one at a time. listview->positionViewAtEnd(); for (int i = 0; i < 18; ++i) diff --git a/tests/auto/qtquick1/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/qtquick1/qdeclarativelistview/tst_qdeclarativelistview.cpp index 5bfa08e943..d2519b0f9f 100644 --- a/tests/auto/qtquick1/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/qtquick1/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -725,9 +725,16 @@ void tst_QDeclarative1ListView::removed(bool animated) QCOMPARE(name->text(), QString("New")); // Add some more items so that we don't run out - for (int i = 50; i < 100; i++) + model.clear(); + for (int i = 0; i < 50; i++) model.addItem("Item" + QString::number(i), ""); + // QTBUG-QTBUG-20575 + listview->setCurrentIndex(0); + listview->setContentY(30); + model.removeItem(0); + QTRY_VERIFY(name = findItem<QDeclarative1Text>(contentItem, "textName", 0)); + // QTBUG-19198 move to end and remove all visible items one at a time. listview->positionViewAtEnd(); for (int i = 0; i < 18; ++i) |