aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qtquick1/qdeclarativexmllistmodel/data
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qtquick1/qdeclarativexmllistmodel/data')
-rw-r--r--tests/auto/qtquick1/qdeclarativexmllistmodel/data/get.qml61
-rw-r--r--tests/auto/qtquick1/qdeclarativexmllistmodel/data/model.qml10
-rw-r--r--tests/auto/qtquick1/qdeclarativexmllistmodel/data/model.xml54
-rw-r--r--tests/auto/qtquick1/qdeclarativexmllistmodel/data/model2.xml14
-rw-r--r--tests/auto/qtquick1/qdeclarativexmllistmodel/data/propertychanges.qml10
-rw-r--r--tests/auto/qtquick1/qdeclarativexmllistmodel/data/recipes.qml10
-rw-r--r--tests/auto/qtquick1/qdeclarativexmllistmodel/data/recipes.xml90
-rw-r--r--tests/auto/qtquick1/qdeclarativexmllistmodel/data/roleCrash.qml7
-rw-r--r--tests/auto/qtquick1/qdeclarativexmllistmodel/data/roleErrors.qml10
-rw-r--r--tests/auto/qtquick1/qdeclarativexmllistmodel/data/roleKeys.qml13
-rw-r--r--tests/auto/qtquick1/qdeclarativexmllistmodel/data/testtypes.qml8
-rw-r--r--tests/auto/qtquick1/qdeclarativexmllistmodel/data/unique.qml8
12 files changed, 295 insertions, 0 deletions
diff --git a/tests/auto/qtquick1/qdeclarativexmllistmodel/data/get.qml b/tests/auto/qtquick1/qdeclarativexmllistmodel/data/get.qml
new file mode 100644
index 0000000000..4e03503f90
--- /dev/null
+++ b/tests/auto/qtquick1/qdeclarativexmllistmodel/data/get.qml
@@ -0,0 +1,61 @@
+import QtQuick 1.0
+
+XmlListModel {
+ source: "model.xml"
+ query: "/Pets/Pet"
+ XmlRole { name: "name"; query: "name/string()" }
+ XmlRole { name: "type"; query: "type/string()" }
+ XmlRole { name: "age"; query: "age/number()" }
+ XmlRole { name: "size"; query: "size/string()" }
+
+ id: root
+
+ property bool preTest: false
+ property bool postTest: false
+
+ function runPreTest() {
+ if (root.get(0) != undefined)
+ return;
+
+ preTest = true;
+ }
+
+ function runPostTest() {
+ if (root.get(-1) != undefined)
+ return;
+
+ var row = root.get(0);
+ if (row.name != "Polly" ||
+ row.type != "Parrot" ||
+ row.age != 12 ||
+ row.size != "Small")
+ return;
+
+ row = root.get(1);
+ if (row.name != "Penny" ||
+ row.type != "Turtle" ||
+ row.age != 4 ||
+ row.size != "Small")
+ return;
+
+ row = root.get(7);
+ if (row.name != "Rover" ||
+ row.type != "Dog" ||
+ row.age != 0 ||
+ row.size != "Large")
+ return;
+
+ row = root.get(8);
+ if (row.name != "Tiny" ||
+ row.type != "Elephant" ||
+ row.age != 15 ||
+ row.size != "Large")
+ return;
+
+ if (root.get(9) != undefined)
+ return;
+
+ postTest = true;
+ }
+}
+
diff --git a/tests/auto/qtquick1/qdeclarativexmllistmodel/data/model.qml b/tests/auto/qtquick1/qdeclarativexmllistmodel/data/model.qml
new file mode 100644
index 0000000000..fdacb6c445
--- /dev/null
+++ b/tests/auto/qtquick1/qdeclarativexmllistmodel/data/model.qml
@@ -0,0 +1,10 @@
+import QtQuick 1.0
+
+XmlListModel {
+ source: "model.xml"
+ query: "/Pets/Pet"
+ XmlRole { name: "name"; query: "name/string()" }
+ XmlRole { name: "type"; query: "type/string()" }
+ XmlRole { name: "age"; query: "age/number()" }
+ XmlRole { name: "size"; query: "size/string()" }
+}
diff --git a/tests/auto/qtquick1/qdeclarativexmllistmodel/data/model.xml b/tests/auto/qtquick1/qdeclarativexmllistmodel/data/model.xml
new file mode 100644
index 0000000000..40cd6d0432
--- /dev/null
+++ b/tests/auto/qtquick1/qdeclarativexmllistmodel/data/model.xml
@@ -0,0 +1,54 @@
+<Pets>
+ <Pet>
+ <name>Polly</name>
+ <type>Parrot</type>
+ <age>12</age>
+ <size>Small</size>
+ </Pet>
+ <Pet>
+ <name>Penny</name>
+ <type>Turtle</type>
+ <age>4</age>
+ <size>Small</size>
+ </Pet>
+ <Pet>
+ <name>Warren</name>
+ <type>Rabbit</type>
+ <age>2</age>
+ <size>Small</size>
+ </Pet>
+ <Pet>
+ <name>Spot</name>
+ <type>Dog</type>
+ <age>9</age>
+ <size>Medium</size>
+ </Pet>
+ <Pet>
+ <name>Whiskers</name>
+ <type>Cat</type>
+ <age>2</age>
+ <size>Medium</size>
+ </Pet>
+ <Pet>
+ <name>Joey</name>
+ <type>Kangaroo</type>
+ <age>1</age>
+ </Pet>
+ <Pet>
+ <name>Kimba</name>
+ <type>Bunny</type>
+ <age>65</age>
+ <size>Large</size>
+ </Pet>
+ <Pet>
+ <name>Rover</name>
+ <type>Dog</type>
+ <size>Large</size>
+ </Pet>
+ <Pet>
+ <name>Tiny</name>
+ <type>Elephant</type>
+ <age>15</age>
+ <size>Large</size>
+ </Pet>
+</Pets>
diff --git a/tests/auto/qtquick1/qdeclarativexmllistmodel/data/model2.xml b/tests/auto/qtquick1/qdeclarativexmllistmodel/data/model2.xml
new file mode 100644
index 0000000000..dab2ec6dc0
--- /dev/null
+++ b/tests/auto/qtquick1/qdeclarativexmllistmodel/data/model2.xml
@@ -0,0 +1,14 @@
+<Pets>
+ <Pet>
+ <name>Polly</name>
+ <type>Parrot</type>
+ <age>12</age>
+ <size>Small</size>
+ </Pet>
+ <Pet>
+ <name>Penny</name>
+ <type>Turtle</type>
+ <age>4</age>
+ <size>Small</size>
+ </Pet>
+</Pets>
diff --git a/tests/auto/qtquick1/qdeclarativexmllistmodel/data/propertychanges.qml b/tests/auto/qtquick1/qdeclarativexmllistmodel/data/propertychanges.qml
new file mode 100644
index 0000000000..ed674ce36f
--- /dev/null
+++ b/tests/auto/qtquick1/qdeclarativexmllistmodel/data/propertychanges.qml
@@ -0,0 +1,10 @@
+import QtQuick 1.0
+
+XmlListModel {
+ source: "model.xml"
+ query: "/Pets/Pet"
+ XmlRole { objectName: "role"; name: "name"; query: "name/string()" }
+ XmlRole { name: "type"; query: "type/string()" }
+ XmlRole { name: "age"; query: "age/number()" }
+ XmlRole { name: "size"; query: "size/string()" }
+}
diff --git a/tests/auto/qtquick1/qdeclarativexmllistmodel/data/recipes.qml b/tests/auto/qtquick1/qdeclarativexmllistmodel/data/recipes.qml
new file mode 100644
index 0000000000..6345101d9a
--- /dev/null
+++ b/tests/auto/qtquick1/qdeclarativexmllistmodel/data/recipes.qml
@@ -0,0 +1,10 @@
+import QtQuick 1.0
+
+XmlListModel {
+ source: "recipes.xml"
+ query: "/recipes/recipe"
+ XmlRole { name: "title"; query: "@title/string()" }
+ XmlRole { name: "picture"; query: "picture/string()" }
+ XmlRole { name: "ingredients"; query: "ingredients/string()" }
+ XmlRole { name: "preparation"; query: "method/string()" }
+}
diff --git a/tests/auto/qtquick1/qdeclarativexmllistmodel/data/recipes.xml b/tests/auto/qtquick1/qdeclarativexmllistmodel/data/recipes.xml
new file mode 100644
index 0000000000..d71de60710
--- /dev/null
+++ b/tests/auto/qtquick1/qdeclarativexmllistmodel/data/recipes.xml
@@ -0,0 +1,90 @@
+<recipes>
+ <recipe title="Pancakes">
+ <picture>content/pics/pancakes.jpg</picture>
+ <ingredients><![CDATA[<html>
+ <ul>
+ <li> 1 cup (150g) self-raising flour
+ <li> 1 tbs caster sugar
+ <li> 3/4 cup (185ml) milk
+ <li> 1 egg
+ </ul>
+ </html>
+ ]]></ingredients>
+ <method><![CDATA[<html>
+ <ol>
+ <li> Sift flour and sugar together into a bowl. Add a pinch of salt.
+ <li> Beat milk and egg together, then add to dry ingredients. Beat until smooth.
+ <li> Pour mixture into a pan on medium heat and cook until bubbles appear on the surface.
+ <li> Turn over and cook other side until golden.
+ </ol>
+ </html>
+ ]]></method>
+ </recipe>
+ <recipe title="Fruit Salad">
+ <picture>content/pics/fruit-salad.jpg</picture>
+ <ingredients><![CDATA[* Seasonal Fruit]]></ingredients>
+ <method><![CDATA[* Chop fruit and place in a bowl.]]></method>
+ </recipe>
+ <recipe title="Vegetable Soup">
+ <picture>content/pics/vegetable-soup.jpg</picture>
+ <ingredients><![CDATA[<html>
+ <ul>
+ <li> 1 onion
+ <li> 1 turnip
+ <li> 1 potato
+ <li> 1 carrot
+ <li> 1 head of celery
+ <li> 1 1/2 litres of water
+ </ul>
+ </html>
+ ]]></ingredients>
+ <method><![CDATA[<html>
+ <ol>
+ <li> Chop vegetables.
+ <li> Boil in water until vegetables soften.
+ <li> Season with salt and pepper to taste.
+ </ol>
+ </html>
+ ]]></method>
+ </recipe>
+ <recipe title="Hamburger">
+ <picture>content/pics/hamburger.jpg</picture>
+ <ingredients><![CDATA[<html>
+ <ul>
+ <li> 500g minced beef
+ <li> Seasoning
+ <li> lettuce, tomato, onion, cheese
+ <li> 1 hamburger bun for each burger
+ </ul>
+ </html>
+ ]]></ingredients>
+ <method><![CDATA[<html>
+ <ol>
+ <li> Mix the beef, together with seasoning, in a food processor.
+ <li> Shape the beef into burgers.
+ <li> Grill the burgers for about 5 mins on each side (until cooked through)
+ <li> Serve each burger on a bun with ketchup, cheese, lettuce, tomato and onion.
+ </ol>
+ </html>
+ ]]></method>
+ </recipe>
+ <recipe title="Lemonade">
+ <picture>content/pics/lemonade.jpg</picture>
+ <ingredients><![CDATA[<html>
+ <ul>
+ <li> 1 cup Lemon Juice
+ <li> 1 cup Sugar
+ <li> 6 Cups of Water (2 cups warm water, 4 cups cold water)
+ </ul>
+ </html>
+ ]]></ingredients>
+ <method><![CDATA[<html>
+ <ol>
+ <li> Pour 2 cups of warm water into a pitcher and stir in sugar until it dissolves.
+ <li> Pour in lemon juice, stir again, and add 4 cups of cold water.
+ <li> Chill or serve over ice cubes.
+ </ol>
+ </html>
+ ]]></method>
+ </recipe>
+</recipes>
diff --git a/tests/auto/qtquick1/qdeclarativexmllistmodel/data/roleCrash.qml b/tests/auto/qtquick1/qdeclarativexmllistmodel/data/roleCrash.qml
new file mode 100644
index 0000000000..492dad920f
--- /dev/null
+++ b/tests/auto/qtquick1/qdeclarativexmllistmodel/data/roleCrash.qml
@@ -0,0 +1,7 @@
+import QtQuick 1.0
+
+XmlListModel {
+ id: model
+ XmlRole {}
+ Component.onCompleted: model.roles = 0
+}
diff --git a/tests/auto/qtquick1/qdeclarativexmllistmodel/data/roleErrors.qml b/tests/auto/qtquick1/qdeclarativexmllistmodel/data/roleErrors.qml
new file mode 100644
index 0000000000..a0d846f188
--- /dev/null
+++ b/tests/auto/qtquick1/qdeclarativexmllistmodel/data/roleErrors.qml
@@ -0,0 +1,10 @@
+import QtQuick 1.0
+
+XmlListModel {
+ source: "model.xml"
+ query: "/Pets/Pet"
+ XmlRole { name: "name"; query: "/name/string()" } //starts with '/'
+ XmlRole { name: "type"; query: "type" } //no type
+ XmlRole { name: "age"; query: "age/" } //ends with '/'
+ XmlRole { name: "size"; query: "size/number()" } //wrong type
+}
diff --git a/tests/auto/qtquick1/qdeclarativexmllistmodel/data/roleKeys.qml b/tests/auto/qtquick1/qdeclarativexmllistmodel/data/roleKeys.qml
new file mode 100644
index 0000000000..d90cd61096
--- /dev/null
+++ b/tests/auto/qtquick1/qdeclarativexmllistmodel/data/roleKeys.qml
@@ -0,0 +1,13 @@
+import QtQuick 1.0
+
+XmlListModel {
+ query: "/data/item"
+ XmlRole { id: nameRole; name: "name"; query: "name/string()"; isKey: true }
+ XmlRole { name: "age"; query: "age/number()"; isKey: true }
+ XmlRole { name: "sport"; query: "sport/string()" }
+
+ function disableNameKey() {
+ nameRole.isKey = false;
+ }
+}
+
diff --git a/tests/auto/qtquick1/qdeclarativexmllistmodel/data/testtypes.qml b/tests/auto/qtquick1/qdeclarativexmllistmodel/data/testtypes.qml
new file mode 100644
index 0000000000..4dbcc029e0
--- /dev/null
+++ b/tests/auto/qtquick1/qdeclarativexmllistmodel/data/testtypes.qml
@@ -0,0 +1,8 @@
+import QtQuick 1.0
+
+XmlListModel {
+ query: "/data"
+ XmlRole { name: "stringValue"; query: "a-string/string()" }
+ XmlRole { name: "numberValue"; query: "a-number/number()" }
+}
+
diff --git a/tests/auto/qtquick1/qdeclarativexmllistmodel/data/unique.qml b/tests/auto/qtquick1/qdeclarativexmllistmodel/data/unique.qml
new file mode 100644
index 0000000000..dab8ffa78e
--- /dev/null
+++ b/tests/auto/qtquick1/qdeclarativexmllistmodel/data/unique.qml
@@ -0,0 +1,8 @@
+import QtQuick 1.0
+
+XmlListModel {
+ source: "model.xml"
+ query: "/Pets/Pet"
+ XmlRole { name: "name"; query: "name/string()" }
+ XmlRole { name: "name"; query: "type/string()" }
+}