From a129444bb0156c936900dbd2f12bd9f427ff366c Mon Sep 17 00:00:00 2001 From: Qt by Nokia Date: Wed, 27 Apr 2011 14:13:26 +0200 Subject: Initial import from qtquick2. Branched from the monolithic repo, Qt qtquick2 branch, at commit a4a585d2ee907746682846ae6e8a48e19deef469 --- .../qdeclarativegridview/tst_qdeclarativegridview.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp') diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index c8e7817adc..dba12599f9 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -863,6 +863,8 @@ void tst_QDeclarativeGridView::noCurrentIndex() QCOMPARE(gridview->currentIndex(), 5); QVERIFY(gridview->currentItem()); QVERIFY(gridview->highlightItem()); + + delete canvas; } void tst_QDeclarativeGridView::changeFlow() @@ -1621,6 +1623,8 @@ void tst_QDeclarativeGridView::resetModel() QTRY_VERIFY(display != 0); QTRY_COMPARE(display->text(), strings.at(i)); } + + delete canvas; } void tst_QDeclarativeGridView::enforceRange() @@ -1748,6 +1752,8 @@ void tst_QDeclarativeGridView::QTBUG_8456() QTRY_VERIFY(gridview != 0); QTRY_COMPARE(gridview->currentIndex(), 0); + + delete canvas; } void tst_QDeclarativeGridView::manualHighlight() @@ -1792,6 +1798,8 @@ void tst_QDeclarativeGridView::manualHighlight() QTRY_COMPARE(gridview->currentItem(), findItem(contentItem, "wrapper", 0)); QTRY_COMPARE(gridview->highlightItem()->y() - 5, gridview->currentItem()->y()); QTRY_COMPARE(gridview->highlightItem()->x() - 5, gridview->currentItem()->x()); + + delete canvas; } void tst_QDeclarativeGridView::footer() @@ -1839,6 +1847,8 @@ void tst_QDeclarativeGridView::footer() QCOMPARE(footer->y(), 600.0); QCOMPARE(footer->height(), 20.0); QCOMPARE(gridview->contentY(), 0.0); + + delete canvas; } void tst_QDeclarativeGridView::header() @@ -1888,6 +1898,8 @@ void tst_QDeclarativeGridView::header() QCOMPARE(header->y(), 10.0); QCOMPARE(header->height(), 20.0); QCOMPARE(gridview->contentY(), 10.0); + + delete canvas; } void tst_QDeclarativeGridView::indexAt() -- cgit v1.2.3 From d91e311ab7de4f2ae4ab147e5dbb8d914c5316da Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 5 May 2011 14:18:28 +1000 Subject: 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) --- .../auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp') diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index dba12599f9..bedcfda51f 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -222,6 +222,7 @@ void tst_QDeclarativeGridView::items() QTRY_VERIFY(contentItem != 0); QTRY_COMPARE(gridview->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 for (int i = 0; i < model.count(); ++i) { @@ -305,6 +306,7 @@ void tst_QDeclarativeGridView::inserted() QTRY_VERIFY(contentItem != 0); model.insertItem(1, "Will", "9876"); + 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 @@ -382,6 +384,7 @@ void tst_QDeclarativeGridView::removed() QTRY_VERIFY(contentItem != 0); model.removeItem(1); + QCOMPARE(canvas->rootObject()->property("count").toInt(), model.count()); QDeclarativeText *name = findItem(contentItem, "textName", 1); QTRY_VERIFY(name != 0); -- cgit v1.2.3