aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qtquick2/qquickrepeater/data
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qtquick2/qquickrepeater/data')
-rw-r--r--tests/auto/qtquick2/qquickrepeater/data/asyncloader.qml32
-rw-r--r--tests/auto/qtquick2/qquickrepeater/data/initparent.qml12
-rw-r--r--tests/auto/qtquick2/qquickrepeater/data/intmodel.qml29
-rw-r--r--tests/auto/qtquick2/qquickrepeater/data/itemlist.qml68
-rw-r--r--tests/auto/qtquick2/qquickrepeater/data/modelChanged.qml26
-rw-r--r--tests/auto/qtquick2/qquickrepeater/data/objlist.qml21
-rw-r--r--tests/auto/qtquick2/qquickrepeater/data/properties.qml11
-rw-r--r--tests/auto/qtquick2/qquickrepeater/data/repeater1.qml28
-rw-r--r--tests/auto/qtquick2/qquickrepeater/data/repeater2.qml36
9 files changed, 263 insertions, 0 deletions
diff --git a/tests/auto/qtquick2/qquickrepeater/data/asyncloader.qml b/tests/auto/qtquick2/qquickrepeater/data/asyncloader.qml
new file mode 100644
index 0000000000..82094e2666
--- /dev/null
+++ b/tests/auto/qtquick2/qquickrepeater/data/asyncloader.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.0
+
+Item {
+ width: 360
+ height: 480
+
+ Loader {
+ asynchronous: true
+ sourceComponent: viewComponent
+ }
+
+ Component {
+ id: viewComponent
+ Column {
+ objectName: "container"
+ Repeater {
+ id: repeater
+ objectName: "repeater"
+
+ model: 10
+
+ delegate: Rectangle {
+ objectName: "delegate" + index
+ color: "red"
+ width: 360
+ height: 50
+ Text { text: index }
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/qtquick2/qquickrepeater/data/initparent.qml b/tests/auto/qtquick2/qquickrepeater/data/initparent.qml
new file mode 100644
index 0000000000..e6571f09d3
--- /dev/null
+++ b/tests/auto/qtquick2/qquickrepeater/data/initparent.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property Item parentItem: null
+ Repeater {
+ model: 1
+ Item {
+ Component.onCompleted: root.parentItem = parent
+ }
+ }
+}
diff --git a/tests/auto/qtquick2/qquickrepeater/data/intmodel.qml b/tests/auto/qtquick2/qquickrepeater/data/intmodel.qml
new file mode 100644
index 0000000000..30a650dd52
--- /dev/null
+++ b/tests/auto/qtquick2/qquickrepeater/data/intmodel.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+ objectName: "container"
+ width: 240
+ height: 320
+ color: "white"
+
+ function checkProperties() {
+ testObject.error = false;
+ if (repeater.delegate != comp) {
+ console.log("delegate property incorrect");
+ testObject.error = true;
+ }
+ }
+
+ Component {
+ id: comp
+ Item{}
+ }
+
+ Repeater {
+ id: repeater
+ objectName: "repeater"
+ model: testData
+ delegate: comp
+ }
+}
diff --git a/tests/auto/qtquick2/qquickrepeater/data/itemlist.qml b/tests/auto/qtquick2/qquickrepeater/data/itemlist.qml
new file mode 100644
index 0000000000..174bfd4d18
--- /dev/null
+++ b/tests/auto/qtquick2/qquickrepeater/data/itemlist.qml
@@ -0,0 +1,68 @@
+// This example demonstrates placing items in a view using
+// a VisualItemModel
+
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ color: "lightgray"
+ width: 240
+ height: 320
+ property variant itemModel: itemModel1
+
+ function checkProperties() {
+ testObject.error = false;
+ if (testObject.useModel && view.model != root.itemModel) {
+ console.log("model property incorrect");
+ testObject.error = true;
+ }
+ }
+
+ function switchModel() {
+ root.itemModel = itemModel2
+ }
+
+ VisualItemModel {
+ id: itemModel1
+ objectName: "itemModel1"
+ Rectangle {
+ objectName: "item1"
+ height: 50; width: 100; color: "#FFFEF0"
+ Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ Rectangle {
+ objectName: "item2"
+ height: 50; width: 100; color: "#F0FFF7"
+ Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ Rectangle {
+ objectName: "item3"
+ height: 50; width: 100; color: "#F4F0FF"
+ Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ }
+
+ VisualItemModel {
+ id: itemModel2
+ objectName: "itemModel2"
+ Rectangle {
+ objectName: "item4"
+ height: 50; width: 100; color: "#FFFEF0"
+ Text { objectName: "text4"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ Rectangle {
+ objectName: "item5"
+ height: 50; width: 100; color: "#F0FFF7"
+ Text { objectName: "text5"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ }
+
+ Column {
+ objectName: "container"
+ Repeater {
+ id: view
+ objectName: "repeater"
+ model: testObject.useModel ? root.itemModel : 0
+ }
+ }
+}
diff --git a/tests/auto/qtquick2/qquickrepeater/data/modelChanged.qml b/tests/auto/qtquick2/qquickrepeater/data/modelChanged.qml
new file mode 100644
index 0000000000..23af127e79
--- /dev/null
+++ b/tests/auto/qtquick2/qquickrepeater/data/modelChanged.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+Column {
+ Repeater {
+ id: repeater
+ objectName: "repeater"
+
+ property int itemsCount
+ property variant itemsFound: []
+
+ delegate: Rectangle {
+ color: "red"
+ width: (index+1)*50
+ height: 50
+ }
+
+ onModelChanged: {
+ repeater.itemsCount = repeater.count
+ var items = []
+ for (var i=0; i<repeater.count; i++)
+ items.push(repeater.itemAt(i))
+ repeater.itemsFound = items
+ }
+ }
+}
+
diff --git a/tests/auto/qtquick2/qquickrepeater/data/objlist.qml b/tests/auto/qtquick2/qquickrepeater/data/objlist.qml
new file mode 100644
index 0000000000..c49d5926e5
--- /dev/null
+++ b/tests/auto/qtquick2/qquickrepeater/data/objlist.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+ objectName: "container"
+ width: 240
+ height: 320
+ color: "white"
+ Repeater {
+ id: repeater
+ objectName: "repeater"
+ model: testData
+ property int errors: 0
+ property int instantiated: 0
+ Component {
+ Item{
+ Component.onCompleted: {if(index!=modelData.idx) repeater.errors += 1; repeater.instantiated++}
+ }
+ }
+ }
+}
diff --git a/tests/auto/qtquick2/qquickrepeater/data/properties.qml b/tests/auto/qtquick2/qquickrepeater/data/properties.qml
new file mode 100644
index 0000000000..035431c784
--- /dev/null
+++ b/tests/auto/qtquick2/qquickrepeater/data/properties.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+Row {
+ Repeater {
+ objectName: "repeater"
+ model: 5
+ Text {
+ text: "I'm item " + index
+ }
+ }
+}
diff --git a/tests/auto/qtquick2/qquickrepeater/data/repeater1.qml b/tests/auto/qtquick2/qquickrepeater/data/repeater1.qml
new file mode 100644
index 0000000000..596dc9131e
--- /dev/null
+++ b/tests/auto/qtquick2/qquickrepeater/data/repeater1.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+ objectName: "container"
+ width: 240
+ height: 320
+ color: "white"
+ Text {
+ text: "Zero"
+ }
+ Repeater {
+ id: repeater
+ objectName: "repeater"
+ width: 240
+ height: 320
+ model: testData
+ Component {
+ Text {
+ y: index*20
+ text: modelData
+ }
+ }
+ }
+ Text {
+ text: "Last"
+ }
+}
diff --git a/tests/auto/qtquick2/qquickrepeater/data/repeater2.qml b/tests/auto/qtquick2/qquickrepeater/data/repeater2.qml
new file mode 100644
index 0000000000..691fbda1e5
--- /dev/null
+++ b/tests/auto/qtquick2/qquickrepeater/data/repeater2.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 240
+ height: 320
+ color: "white"
+ Component {
+ id: myDelegate
+ Item {
+ objectName: "myDelegate"
+ height: 20
+ width: 240
+ Text {
+ objectName: "myName"
+ text: name
+ }
+ Text {
+ objectName: "myNumber"
+ x: 100
+ text: number
+ }
+ }
+ }
+ Column {
+ id: container
+ objectName: "container"
+ Repeater {
+ id: repeater
+ objectName: "repeater"
+ width: 240
+ height: 320
+ delegate: myDelegate
+ model: testData
+ }
+ }
+}