aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2011-05-05 14:18:28 +1000
committerOlivier Goffart <olivier.goffart@nokia.com>2011-05-11 17:00:06 +0200
commitbc83e44dc31cf4688d9b10d0540e61f5d0e37cdc (patch)
tree29663e6110763c7d1822ffde1ab21569711f951f /tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
parentdb49ce3f88653fffd6aa967a7acd73058ba1f214 (diff)
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 (cherry picked from commit 4fbcb6a531bf424a8dbbbd0ca2947d9e15118885)
Diffstat (limited to 'tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp')
-rw-r--r--tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
index 46c351985f..24b1115835 100644
--- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
+++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
@@ -253,6 +253,8 @@ void tst_QDeclarativePathView::items()
QDeclarativePathView *pathview = findItem<QDeclarativePathView>(canvas->rootObject(), "view");
QVERIFY(pathview != 0);
+ QCOMPARE(pathview->count(), model.count());
+ QCOMPARE(canvas->rootObject()->property("count").toInt(), model.count());
QCOMPARE(pathview->childItems().count(), model.count()+1); // assumes all are visible, including highlight
for (int i = 0; i < model.count(); ++i) {
@@ -400,6 +402,7 @@ void tst_QDeclarativePathView::dataModel()
model.insertItem(4, "orange", "10");
QTest::qWait(100);
+ QCOMPARE(canvas->rootObject()->property("viewCount").toInt(), model.count());
QTRY_COMPARE(findItems<QDeclarativeItem>(pathview, "wrapper").count(), 14);
QVERIFY(pathview->currentIndex() == 0);
@@ -409,6 +412,7 @@ void tst_QDeclarativePathView::dataModel()
QCOMPARE(text->text(), model.name(4));
model.removeItem(2);
+ QCOMPARE(canvas->rootObject()->property("viewCount").toInt(), model.count());
text = findItem<QDeclarativeText>(pathview, "myText", 2);
QVERIFY(text);
QCOMPARE(text->text(), model.name(2));