diff options
Diffstat (limited to 'tests/auto/qtquick1/qdeclarativestates/data')
52 files changed, 999 insertions, 0 deletions
diff --git a/tests/auto/qtquick1/qdeclarativestates/data/ExtendedRectangle.qml b/tests/auto/qtquick1/qdeclarativestates/data/ExtendedRectangle.qml new file mode 100644 index 0000000000..d91f504455 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/ExtendedRectangle.qml @@ -0,0 +1,19 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/Implementation/MyType.qml b/tests/auto/qtquick1/qdeclarativestates/data/Implementation/MyType.qml new file mode 100644 index 0000000000..6ad3b4a6ba --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/Implementation/MyType.qml @@ -0,0 +1,32 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/Implementation/images/qt-logo.png b/tests/auto/qtquick1/qdeclarativestates/data/Implementation/images/qt-logo.png Binary files differnew file mode 100644 index 0000000000..14ddf2a028 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/Implementation/images/qt-logo.png diff --git a/tests/auto/qtquick1/qdeclarativestates/data/QTBUG-14830.qml b/tests/auto/qtquick1/qdeclarativestates/data/QTBUG-14830.qml new file mode 100644 index 0000000000..7f9ddbfa2d --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/QTBUG-14830.qml @@ -0,0 +1,29 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/anchorChanges1.qml b/tests/auto/qtquick1/qdeclarativestates/data/anchorChanges1.qml new file mode 100644 index 0000000000..fad27080fe --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/anchorChanges1.qml @@ -0,0 +1,23 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/anchorChanges2.qml b/tests/auto/qtquick1/qdeclarativestates/data/anchorChanges2.qml new file mode 100644 index 0000000000..e1d4d66abd --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/anchorChanges2.qml @@ -0,0 +1,21 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/anchorChanges3.qml b/tests/auto/qtquick1/qdeclarativestates/data/anchorChanges3.qml new file mode 100644 index 0000000000..116b844489 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/anchorChanges3.qml @@ -0,0 +1,29 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/anchorChanges4.qml b/tests/auto/qtquick1/qdeclarativestates/data/anchorChanges4.qml new file mode 100644 index 0000000000..eaff37345b --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/anchorChanges4.qml @@ -0,0 +1,22 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/anchorChanges5.qml b/tests/auto/qtquick1/qdeclarativestates/data/anchorChanges5.qml new file mode 100644 index 0000000000..ea7b251151 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/anchorChanges5.qml @@ -0,0 +1,22 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/anchorChangesCrash.qml b/tests/auto/qtquick1/qdeclarativestates/data/anchorChangesCrash.qml new file mode 100644 index 0000000000..ca96da8855 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/anchorChangesCrash.qml @@ -0,0 +1,14 @@ +import QtQuick 1.0 + +Rectangle { + id: container + width: 400 + height: 400 + + states: State { + name: "reanchored" + AnchorChanges { + anchors.top: container.top + } + } +} diff --git a/tests/auto/qtquick1/qdeclarativestates/data/anchorRewindBug.qml b/tests/auto/qtquick1/qdeclarativestates/data/anchorRewindBug.qml new file mode 100644 index 0000000000..6277111e68 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/anchorRewindBug.qml @@ -0,0 +1,37 @@ +import QtQuick 1.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 + opacity: 0 + } + } +} diff --git a/tests/auto/qtquick1/qdeclarativestates/data/anchorRewindBug2.qml b/tests/auto/qtquick1/qdeclarativestates/data/anchorRewindBug2.qml new file mode 100644 index 0000000000..d8b02e9b32 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/anchorRewindBug2.qml @@ -0,0 +1,25 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/attachedPropertyChanges.qml b/tests/auto/qtquick1/qdeclarativestates/data/attachedPropertyChanges.qml new file mode 100644 index 0000000000..2cad0504b2 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/attachedPropertyChanges.qml @@ -0,0 +1,20 @@ +import Qt.test 1.0 +import QtQuick 1.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/qtquick1/qdeclarativestates/data/autoStateAtStartupRestoreBug.qml b/tests/auto/qtquick1/qdeclarativestates/data/autoStateAtStartupRestoreBug.qml new file mode 100644 index 0000000000..ccd126f6a7 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/autoStateAtStartupRestoreBug.qml @@ -0,0 +1,18 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/basicBinding.qml b/tests/auto/qtquick1/qdeclarativestates/data/basicBinding.qml new file mode 100644 index 0000000000..2060f03009 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/basicBinding.qml @@ -0,0 +1,12 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/basicBinding2.qml b/tests/auto/qtquick1/qdeclarativestates/data/basicBinding2.qml new file mode 100644 index 0000000000..a329da33dd --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/basicBinding2.qml @@ -0,0 +1,12 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/basicBinding3.qml b/tests/auto/qtquick1/qdeclarativestates/data/basicBinding3.qml new file mode 100644 index 0000000000..cb054d214d --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/basicBinding3.qml @@ -0,0 +1,13 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/basicBinding4.qml b/tests/auto/qtquick1/qdeclarativestates/data/basicBinding4.qml new file mode 100644 index 0000000000..7a740e570c --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/basicBinding4.qml @@ -0,0 +1,17 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/basicChanges.qml b/tests/auto/qtquick1/qdeclarativestates/data/basicChanges.qml new file mode 100644 index 0000000000..08ce7875f0 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/basicChanges.qml @@ -0,0 +1,10 @@ +import QtQuick 1.0 +Rectangle { + id: myRectangle + width: 100; height: 100 + color: "red" + states: State { + name: "blue" + PropertyChanges { target: myRectangle; color: "blue" } + } +} diff --git a/tests/auto/qtquick1/qdeclarativestates/data/basicChanges2.qml b/tests/auto/qtquick1/qdeclarativestates/data/basicChanges2.qml new file mode 100644 index 0000000000..ab97ba18b5 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/basicChanges2.qml @@ -0,0 +1,15 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/basicChanges3.qml b/tests/auto/qtquick1/qdeclarativestates/data/basicChanges3.qml new file mode 100644 index 0000000000..73ac34d7ff --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/basicChanges3.qml @@ -0,0 +1,15 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/basicChanges4.qml b/tests/auto/qtquick1/qdeclarativestates/data/basicChanges4.qml new file mode 100644 index 0000000000..b5df922190 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/basicChanges4.qml @@ -0,0 +1,19 @@ +import Qt.test 1.0 +import QtQuick 1.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/qtquick1/qdeclarativestates/data/basicExtension.qml b/tests/auto/qtquick1/qdeclarativestates/data/basicExtension.qml new file mode 100644 index 0000000000..58c9fbe231 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/basicExtension.qml @@ -0,0 +1,16 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/deleting.qml b/tests/auto/qtquick1/qdeclarativestates/data/deleting.qml new file mode 100644 index 0000000000..d1b3fd3a10 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/deleting.qml @@ -0,0 +1,11 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/deletingState.qml b/tests/auto/qtquick1/qdeclarativestates/data/deletingState.qml new file mode 100644 index 0000000000..654e09cb2e --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/deletingState.qml @@ -0,0 +1,13 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/editProperties.qml b/tests/auto/qtquick1/qdeclarativestates/data/editProperties.qml new file mode 100644 index 0000000000..08d0209615 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/editProperties.qml @@ -0,0 +1,34 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/explicit.qml b/tests/auto/qtquick1/qdeclarativestates/data/explicit.qml new file mode 100644 index 0000000000..426731914f --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/explicit.qml @@ -0,0 +1,15 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/extendsBug.qml b/tests/auto/qtquick1/qdeclarativestates/data/extendsBug.qml new file mode 100644 index 0000000000..a4b77b122e --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/extendsBug.qml @@ -0,0 +1,26 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/fakeExtension.qml b/tests/auto/qtquick1/qdeclarativestates/data/fakeExtension.qml new file mode 100644 index 0000000000..a98c96bedc --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/fakeExtension.qml @@ -0,0 +1,16 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/illegalObj.qml b/tests/auto/qtquick1/qdeclarativestates/data/illegalObj.qml new file mode 100644 index 0000000000..e6444325a3 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/illegalObj.qml @@ -0,0 +1,12 @@ +import QtQuick 1.0 + +Rectangle { + id: myItem + + states : State { + PropertyChanges { + target: myItem + children: Item { id: newItem } + } + } +} diff --git a/tests/auto/qtquick1/qdeclarativestates/data/illegalTempState.qml b/tests/auto/qtquick1/qdeclarativestates/data/illegalTempState.qml new file mode 100644 index 0000000000..c04b03c94b --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/illegalTempState.qml @@ -0,0 +1,21 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/image.png b/tests/auto/qtquick1/qdeclarativestates/data/image.png Binary files differnew file mode 100644 index 0000000000..ed1833c95b --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/image.png diff --git a/tests/auto/qtquick1/qdeclarativestates/data/legalTempState.qml b/tests/auto/qtquick1/qdeclarativestates/data/legalTempState.qml new file mode 100644 index 0000000000..4d500d9e05 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/legalTempState.qml @@ -0,0 +1,23 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/nonExistantProp.qml b/tests/auto/qtquick1/qdeclarativestates/data/nonExistantProp.qml new file mode 100644 index 0000000000..4973b82c3f --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/nonExistantProp.qml @@ -0,0 +1,11 @@ +import QtQuick 1.0 +Rectangle { + id: myRectangle + + width: 100; height: 100 + color: "red" + states: State { + name: "blue" + PropertyChanges { target: myRectangle; colr: "blue" } + } +} diff --git a/tests/auto/qtquick1/qdeclarativestates/data/parentChange1.qml b/tests/auto/qtquick1/qdeclarativestates/data/parentChange1.qml new file mode 100644 index 0000000000..2f7e80eb08 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/parentChange1.qml @@ -0,0 +1,37 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/parentChange2.qml b/tests/auto/qtquick1/qdeclarativestates/data/parentChange2.qml new file mode 100644 index 0000000000..bdd0c6c282 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/parentChange2.qml @@ -0,0 +1,31 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/parentChange3.qml b/tests/auto/qtquick1/qdeclarativestates/data/parentChange3.qml new file mode 100644 index 0000000000..55f3ead7c6 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/parentChange3.qml @@ -0,0 +1,42 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/parentChange4.qml b/tests/auto/qtquick1/qdeclarativestates/data/parentChange4.qml new file mode 100644 index 0000000000..ae05b05072 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/parentChange4.qml @@ -0,0 +1,30 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/parentChange5.qml b/tests/auto/qtquick1/qdeclarativestates/data/parentChange5.qml new file mode 100644 index 0000000000..32a0b91cd9 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/parentChange5.qml @@ -0,0 +1,30 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/parentChange6.qml b/tests/auto/qtquick1/qdeclarativestates/data/parentChange6.qml new file mode 100644 index 0000000000..70ad894ffc --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/parentChange6.qml @@ -0,0 +1,30 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/propertyErrors.qml b/tests/auto/qtquick1/qdeclarativestates/data/propertyErrors.qml new file mode 100644 index 0000000000..3ab3c3252e --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/propertyErrors.qml @@ -0,0 +1,10 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/reset.qml b/tests/auto/qtquick1/qdeclarativestates/data/reset.qml new file mode 100644 index 0000000000..a140ffab4d --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/reset.qml @@ -0,0 +1,19 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/restoreEntryValues.qml b/tests/auto/qtquick1/qdeclarativestates/data/restoreEntryValues.qml new file mode 100644 index 0000000000..dfd7c1794a --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/restoreEntryValues.qml @@ -0,0 +1,14 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/returnToBase.qml b/tests/auto/qtquick1/qdeclarativestates/data/returnToBase.qml new file mode 100644 index 0000000000..a0d053cf03 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/returnToBase.qml @@ -0,0 +1,21 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/script.qml b/tests/auto/qtquick1/qdeclarativestates/data/script.qml new file mode 100644 index 0000000000..630aaf0ffa --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/script.qml @@ -0,0 +1,10 @@ +import QtQuick 1.0 +Rectangle { + id: myRectangle + width: 100; height: 100 + color: "red" + states: State { + name: "blue" + StateChangeScript { script: myRectangle.color = "blue"; } + } +} diff --git a/tests/auto/qtquick1/qdeclarativestates/data/signalOverride.qml b/tests/auto/qtquick1/qdeclarativestates/data/signalOverride.qml new file mode 100644 index 0000000000..0eaf547644 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/signalOverride.qml @@ -0,0 +1,18 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/signalOverride2.qml b/tests/auto/qtquick1/qdeclarativestates/data/signalOverride2.qml new file mode 100644 index 0000000000..ef26ff14e7 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/signalOverride2.qml @@ -0,0 +1,9 @@ +import QtQuick 1.0 +import Qt.test 1.0 + +MyRectangle { + id: rect + onDidSomething: color = "blue" + width: 100; height: 100 + ExtendedRectangle {} +} diff --git a/tests/auto/qtquick1/qdeclarativestates/data/signalOverrideCrash.qml b/tests/auto/qtquick1/qdeclarativestates/data/signalOverrideCrash.qml new file mode 100644 index 0000000000..8e9b698383 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/signalOverrideCrash.qml @@ -0,0 +1,15 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/signalOverrideCrash2.qml b/tests/auto/qtquick1/qdeclarativestates/data/signalOverrideCrash2.qml new file mode 100644 index 0000000000..74df9430c3 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/signalOverrideCrash2.qml @@ -0,0 +1,24 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/unnamedWhen.qml b/tests/auto/qtquick1/qdeclarativestates/data/unnamedWhen.qml new file mode 100644 index 0000000000..4425b4dd49 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/unnamedWhen.qml @@ -0,0 +1,14 @@ +import QtQuick 1.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/qtquick1/qdeclarativestates/data/urlResolution.qml b/tests/auto/qtquick1/qdeclarativestates/data/urlResolution.qml new file mode 100644 index 0000000000..743f5404b0 --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/urlResolution.qml @@ -0,0 +1,12 @@ +import QtQuick 1.0 +import "Implementation" + +Rectangle { + width: 100 + height: 200 + + MyType { + objectName: "MyType" + anchors.fill: parent + } +} diff --git a/tests/auto/qtquick1/qdeclarativestates/data/whenOrdering.qml b/tests/auto/qtquick1/qdeclarativestates/data/whenOrdering.qml new file mode 100644 index 0000000000..48aef5a6ce --- /dev/null +++ b/tests/auto/qtquick1/qdeclarativestates/data/whenOrdering.qml @@ -0,0 +1,11 @@ +import QtQuick 1.0 + +Rectangle { + property bool condition1: false + property bool condition2: false + + states: [ + State { name: "state1"; when: condition1 }, + State { name: "state2"; when: condition2 } + ] +} |