aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qquicklistview/data/sectionpropertychange.qml19
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp20
2 files changed, 31 insertions, 8 deletions
diff --git a/tests/auto/quick/qquicklistview/data/sectionpropertychange.qml b/tests/auto/quick/qquicklistview/data/sectionpropertychange.qml
index f4679b5af0..feb22404d0 100644
--- a/tests/auto/quick/qquicklistview/data/sectionpropertychange.qml
+++ b/tests/auto/quick/qquicklistview/data/sectionpropertychange.qml
@@ -23,12 +23,20 @@ Rectangle {
}
function switchGroups() {
+ myListView.model.move(0,1,1)
if ("title" === myListView.groupBy)
myListView.groupBy = "genre"
else
myListView.groupBy = "title"
}
+ function switchGrouped() {
+ if ("pageCount" === myListView.groupBy)
+ myListView.groupBy = "genre"
+ else
+ myListView.groupBy = "pageCount"
+ }
+
Component.onCompleted: {
myListView.model = generateModel(myListView)
}
@@ -56,11 +64,6 @@ Rectangle {
Text { text: parent.y; anchors.right: parent.right }
}
- onGroupByChanged: {
- model.move(0,1,1)
- section.property = groupBy
- }
-
section {
criteria: ViewSection.FullString
delegate: Rectangle { width: 320; height: 25; color: "lightblue"
@@ -68,15 +71,15 @@ Rectangle {
Text {text: section }
Text { text: parent.y; anchors.right: parent.right }
}
- property: "title"
+ property: myListView.groupBy
}
}
function generateModel(theParent)
{
var books = [
- { "author": "Billy Bob", "genre": "Anarchism", "title": "Frogs and Love" },
- { "author": "Lefty Smith", "genre": "Horror", "title": "Chainsaws for Noobs" }
+ { "author": "Billy Bob", "genre": "Anarchism", "title": "Frogs and Love", "pageCount": 80 },
+ { "author": "Lefty Smith", "genre": "Horror", "title": "Chainsaws for Noobs", "pageCount": 80 }
];
var model = Qt.createQmlObject("import QtQuick 2.0; ListModel {}", theParent);
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index f051e5baca..c6a72306f9 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -2408,6 +2408,26 @@ void tst_QQuickListView::sectionPropertyChange()
QTRY_COMPARE(item->y(), qreal(25. + i*75.));
}
+ QMetaObject::invokeMethod(canvas->rootObject(), "switchGrouped");
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ // Confirm items positioned correctly
+ for (int i = 0; i < 2; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->y(), qreal(25. + i*50.));
+ }
+
+ QMetaObject::invokeMethod(canvas->rootObject(), "switchGrouped");
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ // Confirm items positioned correctly
+ for (int i = 0; i < 2; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->y(), qreal(25. + i*75.));
+ }
+
delete canvas;
}