summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativelistview
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2011-03-15 03:53:34 (GMT)
committerMartin Jones <martin.jones@nokia.com>2011-03-15 04:25:29 (GMT)
commitce38c6e3a9b7eb336cbd9cd1e9520a5000c8f8ac (patch)
tree44800499f1f732c440260500022fe15ada05fd74 /tests/auto/declarative/qdeclarativelistview
parent774cb9eca9ea243436dbf61cdb7081fc270cdec9 (diff)
downloadQt-ce38c6e3a9b7eb336cbd9cd1e9520a5000c8f8ac.zip
Qt-ce38c6e3a9b7eb336cbd9cd1e9520a5000c8f8ac.tar.gz
Qt-ce38c6e3a9b7eb336cbd9cd1e9520a5000c8f8ac.tar.bz2
Regression: currentIndex was not set correctly after model cleared.
Change b3080d78f2ff2d98410249e09d5d7d6e20fd155c stopped the currentIndex from being updated when a new item is added to an empty view. Change-Id: I77a0789fcf3693034a2d7aca173fec669b913b18 Task-number: QTBUG-18123 Reviewed-by: Bea Lam
Diffstat (limited to 'tests/auto/declarative/qdeclarativelistview')
-rw-r--r--tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
index c87318e..2267a89 100644
--- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
+++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
@@ -741,6 +741,13 @@ void tst_QDeclarativeListView::clear()
QTRY_VERIFY(listview->count() == 0);
QTRY_VERIFY(listview->currentItem() == 0);
QTRY_VERIFY(listview->contentY() == 0);
+ QVERIFY(listview->currentIndex() == -1);
+
+ // confirm sanity when adding an item to cleared list
+ model.addItem("New", "1");
+ QTRY_VERIFY(listview->count() == 1);
+ QVERIFY(listview->currentItem() != 0);
+ QVERIFY(listview->currentIndex() == 0);
delete canvas;
}