aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklistview2/data/changingOrientationWithListModel.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qquicklistview2/data/changingOrientationWithListModel.qml')
-rw-r--r--tests/auto/quick/qquicklistview2/data/changingOrientationWithListModel.qml47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklistview2/data/changingOrientationWithListModel.qml b/tests/auto/quick/qquicklistview2/data/changingOrientationWithListModel.qml
new file mode 100644
index 0000000000..366b20b029
--- /dev/null
+++ b/tests/auto/quick/qquicklistview2/data/changingOrientationWithListModel.qml
@@ -0,0 +1,47 @@
+import QtQuick
+
+ListView {
+ id: root
+
+ function allDelegates(valueSelector) {
+ let sum = 0;
+ for (let i = 0; i < root.count; i++)
+ sum += valueSelector(root.itemAtIndex(i));
+ return sum;
+ }
+
+ readonly property bool isXReset: allDelegates(function(item) { return item?.x ?? 0; }) === 0
+ readonly property bool isYReset: allDelegates(function(item) { return item?.y ?? 0; }) === 0
+
+ width: 500
+ height: 500
+ delegate: Rectangle {
+ width: root.width
+ height: root.height
+ color: c
+ }
+ model: ListModel {
+ ListElement {
+ c: "red"
+ }
+ ListElement {
+ c: "green"
+ }
+ ListElement {
+ c: "blue"
+ }
+ ListElement {
+ c: "cyan"
+ }
+ ListElement {
+ c: "magenta"
+ }
+ ListElement {
+ c: "teal"
+ }
+ }
+ clip: true
+ orientation: ListView.Vertical
+ snapMode: ListView.SnapOneItem
+ highlightRangeMode: ListView.StrictlyEnforceRange
+} \ No newline at end of file