aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
diff options
context:
space:
mode:
authorNils Jeisecke <jeisecke@saltation.de>2013-08-06 13:58:15 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-16 18:11:23 +0200
commit290dc6caf65aeecaceb5a67b55cb33f0b059f98a (patch)
treedb078f3a4e2c06a659500dd5b706015134eaca2f /tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
parent295b53059ddfd25e705e6c975195b6f424a89fae (diff)
Fix currentIndex in Qml itemView when assigning an empty model
When assigning an empty model to e.g. a ListView after component initialization has been completed, currentIndex is now correctly set to -1. Change-Id: I540c034944009ccb8894bf84f400658ef9f0371f Task-number: QTBUG-32838 Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'tests/auto/quick/qquicklistview/tst_qquicklistview.cpp')
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 2268f0754c..cd8cc53b40 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -2605,6 +2605,11 @@ void tst_QQuickListView::currentIndex()
listview->setContentY(200);
QTRY_VERIFY(!delegateVisible(listview->currentItem()));
+ // empty model should reset currentIndex to -1
+ QaimModel emptyModel;
+ ctxt->setContextProperty("testModel", &emptyModel);
+ QCOMPARE(listview->currentIndex(), -1);
+
delete window;
}