aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2011-05-30 16:35:52 +1000
committerMartin Jones <martin.jones@nokia.com>2011-05-30 16:35:52 +1000
commit16e75d93ebe652f6e5b919aa89809a92881a37e7 (patch)
tree3caee160c2913ceca306abdccc9ae3a82aae9d6d /tests
parent806f031efeda71d3f4d7d2f949b437493e79cf52 (diff)
Update SG items with recent GV item changes.
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qsggridview/data/gridview1.qml1
-rw-r--r--tests/auto/declarative/qsggridview/tst_qsggridview.cpp3
-rw-r--r--tests/auto/declarative/qsglistview/data/listviewtest.qml1
-rw-r--r--tests/auto/declarative/qsglistview/tst_qsglistview.cpp13
-rw-r--r--tests/auto/declarative/qsgpathview/data/datamodel.qml1
-rw-r--r--tests/auto/declarative/qsgpathview/data/pathview0.qml1
-rw-r--r--tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp4
-rw-r--r--tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp5
8 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/declarative/qsggridview/data/gridview1.qml b/tests/auto/declarative/qsggridview/data/gridview1.qml
index 816fa5f2d1..0f148ed387 100644
--- a/tests/auto/declarative/qsggridview/data/gridview1.qml
+++ b/tests/auto/declarative/qsggridview/data/gridview1.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Rectangle {
id: root
+ property int count: grid.count
property bool showHeader: false
property bool showFooter: false
property int added: -1
diff --git a/tests/auto/declarative/qsggridview/tst_qsggridview.cpp b/tests/auto/declarative/qsggridview/tst_qsggridview.cpp
index 73744794e3..444e1c7a55 100644
--- a/tests/auto/declarative/qsggridview/tst_qsggridview.cpp
+++ b/tests/auto/declarative/qsggridview/tst_qsggridview.cpp
@@ -234,6 +234,7 @@ void tst_QSGGridView::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) {
@@ -318,6 +319,7 @@ void tst_QSGGridView::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
@@ -396,6 +398,7 @@ void tst_QSGGridView::removed()
QTRY_VERIFY(contentItem != 0);
model.removeItem(1);
+ QCOMPARE(canvas->rootObject()->property("count").toInt(), model.count());
QSGText *name = findItem<QSGText>(contentItem, "textName", 1);
QTRY_VERIFY(name != 0);
diff --git a/tests/auto/declarative/qsglistview/data/listviewtest.qml b/tests/auto/declarative/qsglistview/data/listviewtest.qml
index 832eaafa0f..0202de1546 100644
--- a/tests/auto/declarative/qsglistview/data/listviewtest.qml
+++ b/tests/auto/declarative/qsglistview/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/qsglistview/tst_qsglistview.cpp b/tests/auto/declarative/qsglistview/tst_qsglistview.cpp
index 507caede71..e32353ad53 100644
--- a/tests/auto/declarative/qsglistview/tst_qsglistview.cpp
+++ b/tests/auto/declarative/qsglistview/tst_qsglistview.cpp
@@ -399,6 +399,7 @@ void tst_QSGListView::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
@@ -529,6 +530,7 @@ void tst_QSGListView::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<QSGText>(contentItem, "textName", 0);
@@ -597,6 +599,7 @@ void tst_QSGListView::removed(bool animated)
QTRY_VERIFY(contentItem != 0);
model.removeItem(1);
+ QCOMPARE(canvas->rootObject()->property("count").toInt(), model.count());
QSGText *name = findItem<QSGText>(contentItem, "textName", 1);
QTRY_VERIFY(name != 0);
@@ -725,6 +728,16 @@ void tst_QSGListView::removed(bool animated)
QTRY_VERIFY(name = findItem<QSGText>(contentItem, "textName", model.count()-1));
QCOMPARE(name->text(), QString("New"));
+ // Add some more items so that we don't run out
+ for (int i = 50; i < 100; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ // QTBUG-19198 move to end and remove all visible items one at a time.
+ listview->positionViewAtEnd();
+ for (int i = 0; i < 18; ++i)
+ model.removeItems(model.count() - 1, 1);
+ QTRY_VERIFY(findItems<QSGItem>(contentItem, "wrapper").count() > 16);
+
delete canvas;
delete testObject;
}
diff --git a/tests/auto/declarative/qsgpathview/data/datamodel.qml b/tests/auto/declarative/qsgpathview/data/datamodel.qml
index 839049f1fc..44f2aecc0a 100644
--- a/tests/auto/declarative/qsgpathview/data/datamodel.qml
+++ b/tests/auto/declarative/qsgpathview/data/datamodel.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
PathView {
id: pathview
+ property int viewCount: count
objectName: "pathview"
width: 240; height: 320
pathItemCount: testObject.pathItemCount
diff --git a/tests/auto/declarative/qsgpathview/data/pathview0.qml b/tests/auto/declarative/qsgpathview/data/pathview0.qml
index 0204112812..72b71a3c80 100644
--- a/tests/auto/declarative/qsgpathview/data/pathview0.qml
+++ b/tests/auto/declarative/qsgpathview/data/pathview0.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
Rectangle {
id: root
+ property int count: view.count
property int currentA: -1
property int currentB: -1
property real delegateWidth: 60
diff --git a/tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp b/tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp
index 5b95acec68..2c24748f45 100644
--- a/tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp
+++ b/tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp
@@ -268,6 +268,8 @@ void tst_QSGPathView::items()
QSGPathView *pathview = findItem<QSGPathView>(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) {
@@ -416,6 +418,7 @@ void tst_QSGPathView::dataModel()
model.insertItem(4, "orange", "10");
QTest::qWait(100);
+ QCOMPARE(canvas->rootObject()->property("viewCount").toInt(), model.count());
QTRY_COMPARE(findItems<QSGItem>(pathview, "wrapper").count(), 14);
QVERIFY(pathview->currentIndex() == 0);
@@ -425,6 +428,7 @@ void tst_QSGPathView::dataModel()
QCOMPARE(text->text(), model.name(4));
model.removeItem(2);
+ QCOMPARE(canvas->rootObject()->property("viewCount").toInt(), model.count());
text = findItem<QSGText>(pathview, "myText", 2);
QVERIFY(text);
QCOMPARE(text->text(), model.name(2));
diff --git a/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp b/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp
index ce2c816dd6..078c9976ed 100644
--- a/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp
+++ b/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp
@@ -203,6 +203,11 @@ void tst_qsgvisualdatamodel::rootIndex()
QMetaObject::invokeMethod(obj, "setRootToParent");
QVERIFY(qvariant_cast<QModelIndex>(obj->rootIndex()) == QModelIndex());
+ QMetaObject::invokeMethod(obj, "setRoot");
+ QVERIFY(qvariant_cast<QModelIndex>(obj->rootIndex()) == model.index(0,0));
+ model.clear(); // will emit modelReset()
+ QVERIFY(qvariant_cast<QModelIndex>(obj->rootIndex()) == QModelIndex());
+
delete obj;
}