aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickstates/data
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qquickstates/data')
-rw-r--r--tests/auto/quick/qquickstates/data/ExtendedRectangle.qml19
-rw-r--r--tests/auto/quick/qquickstates/data/Implementation/MyType.qml32
-rw-r--r--tests/auto/quick/qquickstates/data/Implementation/images/qt-logo.pngbin0 -> 5149 bytes
-rw-r--r--tests/auto/quick/qquickstates/data/QTBUG-14830.qml29
-rw-r--r--tests/auto/quick/qquickstates/data/anchorChanges1.qml23
-rw-r--r--tests/auto/quick/qquickstates/data/anchorChanges2.qml21
-rw-r--r--tests/auto/quick/qquickstates/data/anchorChanges3.qml29
-rw-r--r--tests/auto/quick/qquickstates/data/anchorChanges4.qml22
-rw-r--r--tests/auto/quick/qquickstates/data/anchorChanges5.qml22
-rw-r--r--tests/auto/quick/qquickstates/data/anchorChangesCrash.qml14
-rw-r--r--tests/auto/quick/qquickstates/data/anchorRewindBug.qml37
-rw-r--r--tests/auto/quick/qquickstates/data/anchorRewindBug2.qml25
-rw-r--r--tests/auto/quick/qquickstates/data/attachedPropertyChanges.qml20
-rw-r--r--tests/auto/quick/qquickstates/data/autoStateAtStartupRestoreBug.qml18
-rw-r--r--tests/auto/quick/qquickstates/data/avoidFastForward.qml17
-rw-r--r--tests/auto/quick/qquickstates/data/basicBinding.qml12
-rw-r--r--tests/auto/quick/qquickstates/data/basicBinding2.qml12
-rw-r--r--tests/auto/quick/qquickstates/data/basicBinding3.qml13
-rw-r--r--tests/auto/quick/qquickstates/data/basicBinding4.qml17
-rw-r--r--tests/auto/quick/qquickstates/data/basicChanges.qml10
-rw-r--r--tests/auto/quick/qquickstates/data/basicChanges2.qml15
-rw-r--r--tests/auto/quick/qquickstates/data/basicChanges3.qml15
-rw-r--r--tests/auto/quick/qquickstates/data/basicChanges4.qml19
-rw-r--r--tests/auto/quick/qquickstates/data/basicExtension.qml16
-rw-r--r--tests/auto/quick/qquickstates/data/deleting.qml11
-rw-r--r--tests/auto/quick/qquickstates/data/deletingState.qml13
-rw-r--r--tests/auto/quick/qquickstates/data/editProperties.qml34
-rw-r--r--tests/auto/quick/qquickstates/data/explicit.qml15
-rw-r--r--tests/auto/quick/qquickstates/data/extendsBug.qml26
-rw-r--r--tests/auto/quick/qquickstates/data/fakeExtension.qml16
-rw-r--r--tests/auto/quick/qquickstates/data/illegalObj.qml12
-rw-r--r--tests/auto/quick/qquickstates/data/illegalTempState.qml21
-rw-r--r--tests/auto/quick/qquickstates/data/image.pngbin0 -> 173 bytes
-rw-r--r--tests/auto/quick/qquickstates/data/legalTempState.qml23
-rw-r--r--tests/auto/quick/qquickstates/data/nonExistantProp.qml11
-rw-r--r--tests/auto/quick/qquickstates/data/parentChange1.qml37
-rw-r--r--tests/auto/quick/qquickstates/data/parentChange2.qml31
-rw-r--r--tests/auto/quick/qquickstates/data/parentChange3.qml42
-rw-r--r--tests/auto/quick/qquickstates/data/parentChange4.qml30
-rw-r--r--tests/auto/quick/qquickstates/data/parentChange5.qml30
-rw-r--r--tests/auto/quick/qquickstates/data/parentChange6.qml30
-rw-r--r--tests/auto/quick/qquickstates/data/propertyErrors.qml10
-rw-r--r--tests/auto/quick/qquickstates/data/reset.qml19
-rw-r--r--tests/auto/quick/qquickstates/data/restoreEntryValues.qml14
-rw-r--r--tests/auto/quick/qquickstates/data/returnToBase.qml21
-rw-r--r--tests/auto/quick/qquickstates/data/revertListBug.qml47
-rw-r--r--tests/auto/quick/qquickstates/data/script.qml10
-rw-r--r--tests/auto/quick/qquickstates/data/signalOverride.qml18
-rw-r--r--tests/auto/quick/qquickstates/data/signalOverride2.qml9
-rw-r--r--tests/auto/quick/qquickstates/data/signalOverrideCrash.qml15
-rw-r--r--tests/auto/quick/qquickstates/data/signalOverrideCrash2.qml24
-rw-r--r--tests/auto/quick/qquickstates/data/signalOverrideCrash3.qml27
-rw-r--r--tests/auto/quick/qquickstates/data/unnamedWhen.qml14
-rw-r--r--tests/auto/quick/qquickstates/data/urlResolution.qml12
-rw-r--r--tests/auto/quick/qquickstates/data/whenOrdering.qml11
55 files changed, 1090 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickstates/data/ExtendedRectangle.qml b/tests/auto/quick/qquickstates/data/ExtendedRectangle.qml
new file mode 100644
index 0000000000..1ea346b841
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/ExtendedRectangle.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+Rectangle {
+ id: extendedRect
+ objectName: "extendedRect"
+ property color extendedColor: "orange"
+
+ width: 100; height: 100
+ color: "red"
+ states: State {
+ name: "green"
+ PropertyChanges {
+ target: rect
+ onDidSomething: {
+ extendedRect.color = "green"
+ extendedColor = "green"
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/Implementation/MyType.qml b/tests/auto/quick/qquickstates/data/Implementation/MyType.qml
new file mode 100644
index 0000000000..01eb32cd4d
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/Implementation/MyType.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.0
+
+Item {
+ Column {
+ anchors.centerIn: parent
+ Image { id: image1; objectName: "image1" }
+ Image { id: image2; objectName: "image2" }
+ Image { id: image3; objectName: "image3" }
+ }
+
+ states: State {
+ name: "SetImageState"
+ PropertyChanges {
+ target: image1
+ source: "images/qt-logo.png"
+ }
+ PropertyChanges {
+ target: image2
+ source: "images/" + "qt-logo.png"
+ }
+ PropertyChanges {
+ target: image3
+ source: "images/" + (true ? "qt-logo.png" : "")
+ }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: parent.state = "SetImageState"
+ }
+
+}
diff --git a/tests/auto/quick/qquickstates/data/Implementation/images/qt-logo.png b/tests/auto/quick/qquickstates/data/Implementation/images/qt-logo.png
new file mode 100644
index 0000000000..14ddf2a028
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/Implementation/images/qt-logo.png
Binary files differ
diff --git a/tests/auto/quick/qquickstates/data/QTBUG-14830.qml b/tests/auto/quick/qquickstates/data/QTBUG-14830.qml
new file mode 100644
index 0000000000..5ba7c3ad6f
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/QTBUG-14830.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 1024
+ height: 768
+
+ Item {
+ id: area
+ objectName: "area"
+ property int numx: 6
+ property int cellwidth: 1024/numx
+
+ onWidthChanged: {
+ width = width>1024?1024:width;
+ }
+
+ state: 'minimal'
+ states: [
+ State {
+ name: 'minimal'
+ PropertyChanges {
+ target: area
+ width: cellwidth
+ }
+ }
+ ]
+
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/anchorChanges1.qml b/tests/auto/quick/qquickstates/data/anchorChanges1.qml
new file mode 100644
index 0000000000..378f5390f9
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/anchorChanges1.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+ width: 200; height: 200
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ width: 50; height: 50
+ color: "green";
+ anchors.left: parent.left
+ anchors.leftMargin: 5
+ }
+ states: State {
+ name: "right"
+ AnchorChanges {
+ id: ancCh
+ target: myRect;
+ anchors.left: undefined
+ anchors.right: container.right
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/anchorChanges2.qml b/tests/auto/quick/qquickstates/data/anchorChanges2.qml
new file mode 100644
index 0000000000..dc7f8ef0d1
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/anchorChanges2.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200; height: 200
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ width: 50; height: 50
+ color: "green";
+ anchors.left: parent.left
+ anchors.leftMargin: 5
+ }
+ states: State {
+ name: "right"
+ AnchorChanges {
+ target: myRect;
+ anchors.left: undefined
+ anchors.right: parent.right
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/anchorChanges3.qml b/tests/auto/quick/qquickstates/data/anchorChanges3.qml
new file mode 100644
index 0000000000..af49575854
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/anchorChanges3.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+ width: 200; height: 200
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ color: "green";
+ anchors.left: parent.left
+ anchors.right: rightGuideline.left
+ anchors.top: topGuideline.top
+ anchors.bottom: container.bottom
+ }
+ Item { objectName: "LeftGuideline"; id: leftGuideline; x: 10 }
+ Item { id: rightGuideline; x: 150 }
+ Item { id: topGuideline; y: 10 }
+ Item { objectName: "BottomGuideline"; id: bottomGuideline; y: 150 }
+ states: State {
+ name: "reanchored"
+ AnchorChanges {
+ target: myRect;
+ anchors.left: leftGuideline.left
+ anchors.right: container.right
+ anchors.top: container.top
+ anchors.bottom: bottomGuideline.bottom
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/anchorChanges4.qml b/tests/auto/quick/qquickstates/data/anchorChanges4.qml
new file mode 100644
index 0000000000..28b55818bd
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/anchorChanges4.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200; height: 200
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ color: "green";
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ Item { objectName: "LeftGuideline"; id: leftGuideline; x: 10 }
+ Item { objectName: "BottomGuideline"; id: bottomGuideline; y: 150 }
+ states: State {
+ name: "reanchored"
+ AnchorChanges {
+ target: myRect;
+ anchors.horizontalCenter: bottomGuideline.horizontalCenter
+ anchors.verticalCenter: leftGuideline.verticalCenter
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/anchorChanges5.qml b/tests/auto/quick/qquickstates/data/anchorChanges5.qml
new file mode 100644
index 0000000000..b1ca968fb9
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/anchorChanges5.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200; height: 200
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ color: "green";
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.baseline: parent.baseline
+ }
+ Item { objectName: "LeftGuideline"; id: leftGuideline; x: 10 }
+ Item { objectName: "BottomGuideline"; id: bottomGuideline; y: 150 }
+ states: State {
+ name: "reanchored"
+ AnchorChanges {
+ target: myRect;
+ anchors.horizontalCenter: bottomGuideline.horizontalCenter
+ anchors.baseline: leftGuideline.baseline
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/anchorChangesCrash.qml b/tests/auto/quick/qquickstates/data/anchorChangesCrash.qml
new file mode 100644
index 0000000000..9af0e4645a
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/anchorChangesCrash.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+ width: 400
+ height: 400
+
+ states: State {
+ name: "reanchored"
+ AnchorChanges {
+ anchors.top: container.top
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/anchorRewindBug.qml b/tests/auto/quick/qquickstates/data/anchorRewindBug.qml
new file mode 100644
index 0000000000..60c537b1ed
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/anchorRewindBug.qml
@@ -0,0 +1,37 @@
+import QtQuick 2.0
+Rectangle {
+ id: container
+ color: "red"
+ height: 200
+ width: 200
+ Column {
+ id: column
+ objectName: "column"
+ anchors.left: container.right
+ anchors.bottom: container.bottom
+
+ Rectangle {
+ id: rectangle
+ color: "blue"
+ height: 100
+ width: 200
+ }
+ Rectangle {
+ color: "blue"
+ height: 100
+ width: 200
+ }
+ }
+ states: State {
+ name: "reanchored"
+ AnchorChanges {
+ target: column
+ anchors.left: undefined
+ anchors.right: container.right
+ }
+ PropertyChanges {
+ target: rectangle
+ visible: false
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/anchorRewindBug2.qml b/tests/auto/quick/qquickstates/data/anchorRewindBug2.qml
new file mode 100644
index 0000000000..574ef473ce
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/anchorRewindBug2.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width:200; height:300
+
+ Rectangle {
+ id: rectangle
+ objectName: "mover"
+ color: "green"
+ width:50; height:50
+ }
+
+ states: [
+ State {
+ name: "anchored"
+ AnchorChanges {
+ target: rectangle
+ anchors.left: root.left
+ anchors.right: root.right
+ anchors.bottom: root.bottom
+ }
+ }
+ ]
+}
diff --git a/tests/auto/quick/qquickstates/data/attachedPropertyChanges.qml b/tests/auto/quick/qquickstates/data/attachedPropertyChanges.qml
new file mode 100644
index 0000000000..413af2ee42
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/attachedPropertyChanges.qml
@@ -0,0 +1,20 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+Item {
+ id: item
+ width: 100; height: 100
+ MyRectangle.foo: 0
+
+ states: State {
+ name: "foo1"
+ PropertyChanges {
+ target: item
+ MyRectangle.foo: 1
+ width: 50
+ }
+ }
+
+ Component.onCompleted: item.state = "foo1"
+}
+
diff --git a/tests/auto/quick/qquickstates/data/autoStateAtStartupRestoreBug.qml b/tests/auto/quick/qquickstates/data/autoStateAtStartupRestoreBug.qml
new file mode 100644
index 0000000000..6cbf524ec2
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/autoStateAtStartupRestoreBug.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int input: 1
+ property int test: 9
+
+ states: [
+ State {
+ name: "portrait"
+ when: root.input == 1
+ PropertyChanges {
+ target: root
+ test: 3
+ }
+ }
+ ]
+}
diff --git a/tests/auto/quick/qquickstates/data/avoidFastForward.qml b/tests/auto/quick/qquickstates/data/avoidFastForward.qml
new file mode 100644
index 0000000000..519befc31e
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/avoidFastForward.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: rect
+ width: 200
+ height: 200
+
+ property int updateCount: 0
+ onColorChanged: updateCount++
+
+ property color aColor: "green"
+
+ states: State {
+ name: "a"
+ PropertyChanges { target: rect; color: aColor }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/basicBinding.qml b/tests/auto/quick/qquickstates/data/basicBinding.qml
new file mode 100644
index 0000000000..59b67d0863
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/basicBinding.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+
+ property color sourceColor: "blue"
+ width: 100; height: 100
+ color: "red"
+ states: State {
+ name: "blue"
+ PropertyChanges { target: myRectangle; color: sourceColor }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/basicBinding2.qml b/tests/auto/quick/qquickstates/data/basicBinding2.qml
new file mode 100644
index 0000000000..55f88120aa
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/basicBinding2.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+
+ property color sourceColor: "red"
+ width: 100; height: 100
+ color: sourceColor
+ states: State {
+ name: "blue"
+ PropertyChanges { target: myRectangle; color: "blue" }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/basicBinding3.qml b/tests/auto/quick/qquickstates/data/basicBinding3.qml
new file mode 100644
index 0000000000..361ab0b091
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/basicBinding3.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+
+ property color sourceColor: "red"
+ property color sourceColor2: "blue"
+ width: 100; height: 100
+ color: sourceColor
+ states: State {
+ name: "blue"
+ PropertyChanges { target: myRectangle; color: sourceColor2 }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/basicBinding4.qml b/tests/auto/quick/qquickstates/data/basicBinding4.qml
new file mode 100644
index 0000000000..b29f0fcf22
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/basicBinding4.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+
+ property color sourceColor: "blue"
+ width: 100; height: 100
+ color: "red"
+ states: [
+ State {
+ name: "blue"
+ PropertyChanges { target: myRectangle; color: sourceColor }
+ },
+ State {
+ name: "green"
+ PropertyChanges { target: myRectangle; color: "green" }
+ }]
+}
diff --git a/tests/auto/quick/qquickstates/data/basicChanges.qml b/tests/auto/quick/qquickstates/data/basicChanges.qml
new file mode 100644
index 0000000000..3e2b73acde
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/basicChanges.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+ width: 100; height: 100
+ color: "red"
+ states: State {
+ name: "blue"
+ PropertyChanges { target: myRectangle; color: "blue" }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/basicChanges2.qml b/tests/auto/quick/qquickstates/data/basicChanges2.qml
new file mode 100644
index 0000000000..5ff46cc60c
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/basicChanges2.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+ width: 100; height: 100
+ color: "red"
+ states: [
+ State {
+ name: "blue"
+ PropertyChanges { target: myRectangle; color: "blue" }
+ },
+ State {
+ name: "green"
+ PropertyChanges { target: myRectangle; color: "green" }
+ }]
+}
diff --git a/tests/auto/quick/qquickstates/data/basicChanges3.qml b/tests/auto/quick/qquickstates/data/basicChanges3.qml
new file mode 100644
index 0000000000..e46e98f75e
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/basicChanges3.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+ width: 100; height: 100
+ color: "red"
+ states: [
+ State {
+ name: "blue"
+ PropertyChanges { target: myRectangle; color: "blue" }
+ },
+ State {
+ name: "bordered"
+ PropertyChanges { target: myRectangle; border.width: 2 }
+ }]
+}
diff --git a/tests/auto/quick/qquickstates/data/basicChanges4.qml b/tests/auto/quick/qquickstates/data/basicChanges4.qml
new file mode 100644
index 0000000000..7da1e0fb2e
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/basicChanges4.qml
@@ -0,0 +1,19 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyRectangle {
+ id: rect
+ width: 100; height: 100
+ color: "red"
+
+ states: State {
+ name: "aBlueDay"
+ PropertyChanges {
+ target: rect
+ onPropertyWithNotifyChanged: { rect.color = "blue"; }
+ }
+ }
+
+ Component.onCompleted: rect.state = "aBlueDay"
+}
+
diff --git a/tests/auto/quick/qquickstates/data/basicExtension.qml b/tests/auto/quick/qquickstates/data/basicExtension.qml
new file mode 100644
index 0000000000..00f5fee287
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/basicExtension.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+ width: 100; height: 100
+ color: "red"
+ states: [
+ State {
+ name: "blue"
+ PropertyChanges { target: myRectangle; color: "blue" }
+ },
+ State {
+ name: "bordered"
+ extend: "blue"
+ PropertyChanges { target: myRectangle; border.width: 2 }
+ }]
+}
diff --git a/tests/auto/quick/qquickstates/data/deleting.qml b/tests/auto/quick/qquickstates/data/deleting.qml
new file mode 100644
index 0000000000..b8e8d33c17
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/deleting.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+ width: 100; height: 100
+ color: "red"
+ states: State {
+ name: "blue"
+ PropertyChanges { target: myRectangle; color: "blue"; objectName: "pc1" }
+ PropertyChanges { target: myRectangle; radius: 5; objectName: "pc2" }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/deletingState.qml b/tests/auto/quick/qquickstates/data/deletingState.qml
new file mode 100644
index 0000000000..68a9c2a24d
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/deletingState.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+ width: 100; height: 100
+ color: "red"
+ StateGroup {
+ id: stateGroup
+ states: State {
+ name: "blue"
+ PropertyChanges { target: myRectangle; color: "blue" }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/editProperties.qml b/tests/auto/quick/qquickstates/data/editProperties.qml
new file mode 100644
index 0000000000..9bff3657ba
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/editProperties.qml
@@ -0,0 +1,34 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+
+ property color sourceColor: "blue"
+ width: 400; height: 400
+ color: "red"
+
+ Rectangle {
+ id: rect2
+ objectName: "rect2"
+ width: parent.width + 2
+ height: 200
+ color: "yellow"
+ }
+
+ states: [
+ State {
+ name: "blue"
+ PropertyChanges {
+ target: rect2
+ width:50
+ height: 40
+ }
+ },
+ State {
+ name: "green"
+ PropertyChanges {
+ target: rect2
+ width: myRectangle.width / 2
+ height: myRectangle.width / 4
+ }
+ }]
+}
diff --git a/tests/auto/quick/qquickstates/data/explicit.qml b/tests/auto/quick/qquickstates/data/explicit.qml
new file mode 100644
index 0000000000..d09893a1db
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/explicit.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+ property color sourceColor: "blue"
+ width: 100; height: 100
+ color: "red"
+ states: State {
+ name: "blue"
+ PropertyChanges {
+ objectName: "changes"
+ target: myRectangle; explicit: true
+ color: sourceColor
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/extendsBug.qml b/tests/auto/quick/qquickstates/data/extendsBug.qml
new file mode 100644
index 0000000000..573341520d
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/extendsBug.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200
+ height: 200
+
+ Rectangle {
+ id: rect
+ objectName: "greenRect"
+ width: 100
+ height: 100
+ color: "green"
+ }
+
+ states:[
+ State {
+ name: "a"
+ PropertyChanges { target: rect; x: 100 }
+ },
+ State {
+ name: "b"
+ extend:"a"
+ PropertyChanges { target: rect; y: 100 }
+ }
+ ]
+}
diff --git a/tests/auto/quick/qquickstates/data/fakeExtension.qml b/tests/auto/quick/qquickstates/data/fakeExtension.qml
new file mode 100644
index 0000000000..6a5c7003f6
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/fakeExtension.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+ width: 100; height: 100
+ color: "red"
+ states: [
+ State {
+ name: "blue"
+ PropertyChanges { target: myRectangle; color: "blue" }
+ },
+ State {
+ name: "green"
+ extend: "blue"
+ PropertyChanges { target: myRectangle; color: "green" }
+ }]
+}
diff --git a/tests/auto/quick/qquickstates/data/illegalObj.qml b/tests/auto/quick/qquickstates/data/illegalObj.qml
new file mode 100644
index 0000000000..a2bbd5d32b
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/illegalObj.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: myItem
+
+ states : State {
+ PropertyChanges {
+ target: myItem
+ children: Item { id: newItem }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/illegalTempState.qml b/tests/auto/quick/qquickstates/data/illegalTempState.qml
new file mode 100644
index 0000000000..9cb39c0728
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/illegalTempState.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: card
+ width: 100; height: 100
+
+ states: [
+ State {
+ name: "placed"
+ PropertyChanges { target: card; state: "idle" }
+ },
+ State {
+ name: "idle"
+ }
+ ]
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: card.state = "placed"
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/image.png b/tests/auto/quick/qquickstates/data/image.png
new file mode 100644
index 0000000000..ed1833c95b
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/image.png
Binary files differ
diff --git a/tests/auto/quick/qquickstates/data/legalTempState.qml b/tests/auto/quick/qquickstates/data/legalTempState.qml
new file mode 100644
index 0000000000..a93860f5cc
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/legalTempState.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: card
+ width: 100; height: 100
+
+ states: [
+ State {
+ name: "placed"
+ onCompleted: card.state = "idle"
+ StateChangeScript { script: console.log("entering placed") }
+ },
+ State {
+ name: "idle"
+ StateChangeScript { script: console.log("entering idle") }
+ }
+ ]
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: card.state = "placed"
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/nonExistantProp.qml b/tests/auto/quick/qquickstates/data/nonExistantProp.qml
new file mode 100644
index 0000000000..ce502699bb
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/nonExistantProp.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+
+ width: 100; height: 100
+ color: "red"
+ states: State {
+ name: "blue"
+ PropertyChanges { target: myRectangle; colr: "blue" }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/parentChange1.qml b/tests/auto/quick/qquickstates/data/parentChange1.qml
new file mode 100644
index 0000000000..663ad1a264
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/parentChange1.qml
@@ -0,0 +1,37 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400; height: 400
+ Item {
+ x: 10; y: 10
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ x: 5
+ width: 100; height: 100
+ color: "red"
+ }
+ }
+ MouseArea {
+ id: clickable
+ anchors.fill: parent
+ }
+
+ Item {
+ x: -100; y: -50
+ Item {
+ id: newParent
+ objectName: "NewParent"
+ x: 248; y: 360
+ }
+ }
+
+ states: State {
+ name: "reparented"
+ when: clickable.pressed
+ ParentChange {
+ target: myRect
+ parent: newParent
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/parentChange2.qml b/tests/auto/quick/qquickstates/data/parentChange2.qml
new file mode 100644
index 0000000000..ae290e961e
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/parentChange2.qml
@@ -0,0 +1,31 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: newParent
+ width: 400; height: 400
+ Item {
+ scale: .5
+ rotation: 15
+ x: 10; y: 10
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ x: 5
+ width: 100; height: 100
+ color: "red"
+ }
+ }
+ MouseArea {
+ id: clickable
+ anchors.fill: parent
+ }
+
+ states: State {
+ name: "reparented"
+ when: clickable.pressed
+ ParentChange {
+ target: myRect
+ parent: newParent
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/parentChange3.qml b/tests/auto/quick/qquickstates/data/parentChange3.qml
new file mode 100644
index 0000000000..46665cb4c8
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/parentChange3.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400; height: 400
+ Item {
+ scale: .5
+ rotation: 15
+ transformOrigin: "Center"
+ x: 10; y: 10
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ x: 5
+ width: 100; height: 100
+ transformOrigin: "BottomLeft"
+ color: "red"
+ }
+ }
+ MouseArea {
+ id: clickable
+ anchors.fill: parent
+ }
+
+ Item {
+ x: 200; y: 200
+ rotation: 52;
+ scale: 2
+ Item {
+ id: newParent
+ x: 100; y: 100
+ }
+ }
+
+ states: State {
+ name: "reparented"
+ when: clickable.pressed
+ ParentChange {
+ target: myRect
+ parent: newParent
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/parentChange4.qml b/tests/auto/quick/qquickstates/data/parentChange4.qml
new file mode 100644
index 0000000000..22de72f8c9
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/parentChange4.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400; height: 400
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ x: 5; y: 5
+ width: 100; height: 100
+ color: "red"
+ }
+ MouseArea {
+ id: clickable
+ anchors.fill: parent
+ }
+
+ Item {
+ id: newParent
+ transform: Scale { xScale: .5; yScale: .7}
+ }
+
+ states: State {
+ name: "reparented"
+ when: clickable.pressed
+ ParentChange {
+ target: myRect
+ parent: newParent
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/parentChange5.qml b/tests/auto/quick/qquickstates/data/parentChange5.qml
new file mode 100644
index 0000000000..c353d2637f
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/parentChange5.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400; height: 400
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ x: 5; y: 5
+ width: 100; height: 100
+ color: "red"
+ }
+ MouseArea {
+ id: clickable
+ anchors.fill: parent
+ }
+
+ Item {
+ id: newParent
+ transform: Rotation { angle: 30; axis { x: 0; y: 1; z: 0 } }
+ }
+
+ states: State {
+ name: "reparented"
+ when: clickable.pressed
+ ParentChange {
+ target: myRect
+ parent: newParent
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/parentChange6.qml b/tests/auto/quick/qquickstates/data/parentChange6.qml
new file mode 100644
index 0000000000..b373dbba20
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/parentChange6.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400; height: 400
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ x: 5; y: 5
+ width: 100; height: 100
+ color: "red"
+ }
+ MouseArea {
+ id: clickable
+ anchors.fill: parent
+ }
+
+ Item {
+ id: newParent
+ rotation: 180
+ }
+
+ states: State {
+ name: "reparented"
+ when: clickable.pressed
+ ParentChange {
+ target: myRect
+ parent: newParent
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/propertyErrors.qml b/tests/auto/quick/qquickstates/data/propertyErrors.qml
new file mode 100644
index 0000000000..ddd636493d
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/propertyErrors.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+ width: 100; height: 100
+ color: "red"
+ states: State {
+ name: "blue"
+ PropertyChanges { target: myRectangle; colr: "blue"; activeFocus: true }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/reset.qml b/tests/auto/quick/qquickstates/data/reset.qml
new file mode 100644
index 0000000000..f0ecab0950
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/reset.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 640
+ height: 480
+ Image {
+ id: image
+ width: 40
+ source: "image.png"
+ }
+
+ states: State {
+ name: "state1"
+ PropertyChanges {
+ target: image
+ width: undefined
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/restoreEntryValues.qml b/tests/auto/quick/qquickstates/data/restoreEntryValues.qml
new file mode 100644
index 0000000000..950a522841
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/restoreEntryValues.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+ width: 100; height: 100
+ color: "red"
+ states: State {
+ name: "blue"
+ PropertyChanges {
+ target: myRectangle
+ restoreEntryValues: false
+ color: "blue"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/returnToBase.qml b/tests/auto/quick/qquickstates/data/returnToBase.qml
new file mode 100644
index 0000000000..9a0ee82397
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/returnToBase.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: theRect
+ property bool triggerState: false
+ property string stateString: ""
+ states: [ State {
+ when: triggerState
+ PropertyChanges {
+ target: theRect
+ stateString: "inState"
+ }
+ },
+ State {
+ name: ""
+ PropertyChanges {
+ target: theRect
+ stateString: "originalState"
+ }
+ }]
+}
diff --git a/tests/auto/quick/qquickstates/data/revertListBug.qml b/tests/auto/quick/qquickstates/data/revertListBug.qml
new file mode 100644
index 0000000000..fbc4bc5ecc
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/revertListBug.qml
@@ -0,0 +1,47 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400; height: 400
+
+ property Item targetItem: rect1
+
+ function switchTargetItem() {
+ if (targetItem === rect1)
+ targetItem = rect2;
+ else
+ targetItem = rect1;
+ }
+
+ states: State {
+ name: "reparented"
+ ParentChange {
+ target: targetItem
+ parent: newParent
+ x: 0; y: 0
+ }
+ }
+
+ Item {
+ objectName: "originalParent1"
+ Rectangle {
+ id: rect1; objectName: "rect1"
+ width: 50; height: 50
+ color: "green"
+ }
+ }
+
+ Item {
+ objectName: "originalParent2"
+ Rectangle {
+ id: rect2; objectName: "rect2"
+ x: 50; y: 50
+ width: 50; height: 50
+ color: "green"
+ }
+ }
+
+ Item {
+ id: newParent; objectName: "newParent"
+ x: 200; y: 100
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/script.qml b/tests/auto/quick/qquickstates/data/script.qml
new file mode 100644
index 0000000000..218f0fae74
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/script.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+ width: 100; height: 100
+ color: "red"
+ states: State {
+ name: "blue"
+ StateChangeScript { script: myRectangle.color = "blue"; }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/signalOverride.qml b/tests/auto/quick/qquickstates/data/signalOverride.qml
new file mode 100644
index 0000000000..9ab8037e51
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/signalOverride.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyRectangle {
+ id: rect
+
+ onDidSomething: color = "blue"
+
+ width: 100; height: 100
+ color: "red"
+ states: State {
+ name: "green"
+ PropertyChanges {
+ target: rect
+ onDidSomething: color = "green"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/signalOverride2.qml b/tests/auto/quick/qquickstates/data/signalOverride2.qml
new file mode 100644
index 0000000000..4e5e335b8b
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/signalOverride2.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyRectangle {
+ id: rect
+ onDidSomething: color = "blue"
+ width: 100; height: 100
+ ExtendedRectangle {}
+}
diff --git a/tests/auto/quick/qquickstates/data/signalOverrideCrash.qml b/tests/auto/quick/qquickstates/data/signalOverrideCrash.qml
new file mode 100644
index 0000000000..3e2ae1e93d
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/signalOverrideCrash.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyRectangle {
+ id: rect
+
+ width: 100; height: 100
+ states: State {
+ name: "overridden"
+ PropertyChanges {
+ target: rect
+ onDidSomething: rect.state = ""
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/signalOverrideCrash2.qml b/tests/auto/quick/qquickstates/data/signalOverrideCrash2.qml
new file mode 100644
index 0000000000..3937874aa2
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/signalOverrideCrash2.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: myRect
+ width: 400
+ height: 400
+
+ states: [
+ State {
+ name: "state1"
+ PropertyChanges {
+ target: myRect
+ onHeightChanged: console.log("Hello World")
+ color: "green"
+ }
+ },
+ State {
+ name: "state2"; extend: "state1"
+ PropertyChanges {
+ target: myRect
+ color: "red"
+ }
+ }]
+}
diff --git a/tests/auto/quick/qquickstates/data/signalOverrideCrash3.qml b/tests/auto/quick/qquickstates/data/signalOverrideCrash3.qml
new file mode 100644
index 0000000000..98d4c57219
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/signalOverrideCrash3.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: myRect
+ width: 400
+ height: 400
+
+ onHeightChanged: console.log("base state")
+
+ states: [
+ State {
+ name: "state1"
+ PropertyChanges {
+ target: myRect
+ onHeightChanged: console.log("state1")
+ color: "green"
+ }
+ },
+ State {
+ name: "state2";
+ PropertyChanges {
+ target: myRect
+ onHeightChanged: console.log("state2")
+ color: "red"
+ }
+ }]
+}
diff --git a/tests/auto/quick/qquickstates/data/unnamedWhen.qml b/tests/auto/quick/qquickstates/data/unnamedWhen.qml
new file mode 100644
index 0000000000..35eacff07b
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/unnamedWhen.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: theRect
+ property bool triggerState: false
+ property string stateString: ""
+ states: State {
+ when: triggerState
+ PropertyChanges {
+ target: theRect
+ stateString: "inState"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/urlResolution.qml b/tests/auto/quick/qquickstates/data/urlResolution.qml
new file mode 100644
index 0000000000..516ac034d6
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/urlResolution.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+import "Implementation"
+
+Rectangle {
+ width: 100
+ height: 200
+
+ MyType {
+ objectName: "MyType"
+ anchors.fill: parent
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/whenOrdering.qml b/tests/auto/quick/qquickstates/data/whenOrdering.qml
new file mode 100644
index 0000000000..92025a2054
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/whenOrdering.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+Rectangle {
+ property bool condition1: false
+ property bool condition2: false
+
+ states: [
+ State { name: "state1"; when: condition1 },
+ State { name: "state2"; when: condition2 }
+ ]
+}