diff options
author | Martin Jones <martin.jones@nokia.com> | 2011-05-05 04:18:28 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2011-05-05 04:18:28 (GMT) |
commit | 4fbcb6a531bf424a8dbbbd0ca2947d9e15118885 (patch) | |
tree | 73e33648cb54f5be25caa46af765080c18f95c36 /tests/auto/declarative/qdeclarativelistview | |
parent | 95aa4e4f9b82c3652ffc93310b190db869d491df (diff) | |
download | Qt-4fbcb6a531bf424a8dbbbd0ca2947d9e15118885.zip Qt-4fbcb6a531bf424a8dbbbd0ca2947d9e15118885.tar.gz Qt-4fbcb6a531bf424a8dbbbd0ca2947d9e15118885.tar.bz2 |
Views do not notify count changes properly
The views don't have a valid count until both a model and a delegate
are provided. But, countChanged() is not called when a delegate is
set after the model, so bindings to count were not evaluated. Also
test that count is updated for insertion/removal
Change-Id: Ic82039a624c02f0bdb2862ac7a6e215df75bb314
Task-number: QTBUG-19037
Reviewed-by: Bea Lam
Diffstat (limited to 'tests/auto/declarative/qdeclarativelistview')
-rw-r--r-- | tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml | 1 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml b/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml index 3cd6f42..75ddabb 100644 --- a/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml @@ -6,6 +6,7 @@ Rectangle { height: 320 color: "#ffffff" + property int count: list.count property bool showHeader: false property bool showFooter: false property real hr: list.visibleArea.heightRatio diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 0c96587..8b90030 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -389,6 +389,7 @@ void tst_QDeclarativeListView::items() QTRY_VERIFY(listview->highlightItem() != 0); QTRY_COMPARE(listview->count(), model.count()); + QTRY_COMPARE(canvas->rootObject()->property("count").toInt(), model.count()); QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item // current item should be first item @@ -517,6 +518,7 @@ void tst_QDeclarativeListView::inserted() model.insertItem(0, "Foo", "1111"); // zero index, and current item + QCOMPARE(canvas->rootObject()->property("count").toInt(), model.count()); QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item name = findItem<QDeclarativeText>(contentItem, "textName", 0); @@ -583,6 +585,7 @@ void tst_QDeclarativeListView::removed(bool animated) QTRY_VERIFY(contentItem != 0); model.removeItem(1); + QCOMPARE(canvas->rootObject()->property("count").toInt(), model.count()); QDeclarativeText *name = findItem<QDeclarativeText>(contentItem, "textName", 1); QTRY_VERIFY(name != 0); |