aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qtquick1/qdeclarativestates
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qtquick1/qdeclarativestates')
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/ExtendedRectangle.qml19
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/Implementation/MyType.qml32
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/Implementation/images/qt-logo.pngbin5149 -> 0 bytes
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/QTBUG-14830.qml29
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/anchorChanges1.qml23
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/anchorChanges2.qml21
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/anchorChanges3.qml29
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/anchorChanges4.qml22
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/anchorChanges5.qml22
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/anchorChangesCrash.qml14
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/anchorRewindBug.qml37
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/anchorRewindBug2.qml25
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/attachedPropertyChanges.qml20
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/autoStateAtStartupRestoreBug.qml18
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/basicBinding.qml12
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/basicBinding2.qml12
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/basicBinding3.qml13
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/basicBinding4.qml17
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/basicChanges.qml10
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/basicChanges2.qml15
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/basicChanges3.qml15
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/basicChanges4.qml19
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/basicExtension.qml16
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/deleting.qml11
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/deletingState.qml13
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/editProperties.qml34
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/explicit.qml15
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/extendsBug.qml26
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/fakeExtension.qml16
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/illegalObj.qml12
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/illegalTempState.qml21
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/image.pngbin173 -> 0 bytes
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/legalTempState.qml23
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/nonExistantProp.qml11
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/parentChange1.qml37
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/parentChange2.qml31
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/parentChange3.qml42
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/parentChange4.qml30
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/parentChange5.qml30
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/parentChange6.qml30
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/propertyErrors.qml10
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/reset.qml19
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/restoreEntryValues.qml14
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/returnToBase.qml21
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/script.qml10
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/signalOverride.qml18
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/signalOverride2.qml9
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/signalOverrideCrash.qml15
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/signalOverrideCrash2.qml24
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/signalOverrideCrash3.qml27
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/unnamedWhen.qml14
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/urlResolution.qml12
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/data/whenOrdering.qml11
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/qdeclarativestates.pro10
-rw-r--r--tests/auto/qtquick1/qdeclarativestates/tst_qdeclarativestates.cpp1526
55 files changed, 0 insertions, 2562 deletions
diff --git a/tests/auto/qtquick1/qdeclarativestates/data/ExtendedRectangle.qml b/tests/auto/qtquick1/qdeclarativestates/data/ExtendedRectangle.qml
deleted file mode 100644
index d91f504455..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/ExtendedRectangle.qml
+++ /dev/null
@@ -1,19 +0,0 @@
-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
deleted file mode 100644
index 6ad3b4a6ba..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/Implementation/MyType.qml
+++ /dev/null
@@ -1,32 +0,0 @@
-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
deleted file mode 100644
index 14ddf2a028..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/Implementation/images/qt-logo.png
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qtquick1/qdeclarativestates/data/QTBUG-14830.qml b/tests/auto/qtquick1/qdeclarativestates/data/QTBUG-14830.qml
deleted file mode 100644
index 7f9ddbfa2d..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/QTBUG-14830.qml
+++ /dev/null
@@ -1,29 +0,0 @@
-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
deleted file mode 100644
index fad27080fe..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/anchorChanges1.qml
+++ /dev/null
@@ -1,23 +0,0 @@
-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
deleted file mode 100644
index e1d4d66abd..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/anchorChanges2.qml
+++ /dev/null
@@ -1,21 +0,0 @@
-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
deleted file mode 100644
index 116b844489..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/anchorChanges3.qml
+++ /dev/null
@@ -1,29 +0,0 @@
-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
deleted file mode 100644
index eaff37345b..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/anchorChanges4.qml
+++ /dev/null
@@ -1,22 +0,0 @@
-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
deleted file mode 100644
index ea7b251151..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/anchorChanges5.qml
+++ /dev/null
@@ -1,22 +0,0 @@
-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
deleted file mode 100644
index ca96da8855..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/anchorChangesCrash.qml
+++ /dev/null
@@ -1,14 +0,0 @@
-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
deleted file mode 100644
index 6277111e68..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/anchorRewindBug.qml
+++ /dev/null
@@ -1,37 +0,0 @@
-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
deleted file mode 100644
index d8b02e9b32..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/anchorRewindBug2.qml
+++ /dev/null
@@ -1,25 +0,0 @@
-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
deleted file mode 100644
index 2cad0504b2..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/attachedPropertyChanges.qml
+++ /dev/null
@@ -1,20 +0,0 @@
-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
deleted file mode 100644
index ccd126f6a7..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/autoStateAtStartupRestoreBug.qml
+++ /dev/null
@@ -1,18 +0,0 @@
-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
deleted file mode 100644
index 2060f03009..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/basicBinding.qml
+++ /dev/null
@@ -1,12 +0,0 @@
-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
deleted file mode 100644
index a329da33dd..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/basicBinding2.qml
+++ /dev/null
@@ -1,12 +0,0 @@
-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
deleted file mode 100644
index cb054d214d..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/basicBinding3.qml
+++ /dev/null
@@ -1,13 +0,0 @@
-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
deleted file mode 100644
index 7a740e570c..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/basicBinding4.qml
+++ /dev/null
@@ -1,17 +0,0 @@
-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
deleted file mode 100644
index 08ce7875f0..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/basicChanges.qml
+++ /dev/null
@@ -1,10 +0,0 @@
-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
deleted file mode 100644
index ab97ba18b5..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/basicChanges2.qml
+++ /dev/null
@@ -1,15 +0,0 @@
-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
deleted file mode 100644
index 73ac34d7ff..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/basicChanges3.qml
+++ /dev/null
@@ -1,15 +0,0 @@
-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
deleted file mode 100644
index b5df922190..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/basicChanges4.qml
+++ /dev/null
@@ -1,19 +0,0 @@
-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
deleted file mode 100644
index 58c9fbe231..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/basicExtension.qml
+++ /dev/null
@@ -1,16 +0,0 @@
-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
deleted file mode 100644
index d1b3fd3a10..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/deleting.qml
+++ /dev/null
@@ -1,11 +0,0 @@
-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
deleted file mode 100644
index 654e09cb2e..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/deletingState.qml
+++ /dev/null
@@ -1,13 +0,0 @@
-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
deleted file mode 100644
index 08d0209615..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/editProperties.qml
+++ /dev/null
@@ -1,34 +0,0 @@
-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
deleted file mode 100644
index 426731914f..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/explicit.qml
+++ /dev/null
@@ -1,15 +0,0 @@
-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
deleted file mode 100644
index a4b77b122e..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/extendsBug.qml
+++ /dev/null
@@ -1,26 +0,0 @@
-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
deleted file mode 100644
index a98c96bedc..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/fakeExtension.qml
+++ /dev/null
@@ -1,16 +0,0 @@
-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
deleted file mode 100644
index e6444325a3..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/illegalObj.qml
+++ /dev/null
@@ -1,12 +0,0 @@
-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
deleted file mode 100644
index c04b03c94b..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/illegalTempState.qml
+++ /dev/null
@@ -1,21 +0,0 @@
-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
deleted file mode 100644
index ed1833c95b..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/image.png
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qtquick1/qdeclarativestates/data/legalTempState.qml b/tests/auto/qtquick1/qdeclarativestates/data/legalTempState.qml
deleted file mode 100644
index 4d500d9e05..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/legalTempState.qml
+++ /dev/null
@@ -1,23 +0,0 @@
-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
deleted file mode 100644
index 4973b82c3f..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/nonExistantProp.qml
+++ /dev/null
@@ -1,11 +0,0 @@
-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
deleted file mode 100644
index 2f7e80eb08..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/parentChange1.qml
+++ /dev/null
@@ -1,37 +0,0 @@
-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
deleted file mode 100644
index bdd0c6c282..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/parentChange2.qml
+++ /dev/null
@@ -1,31 +0,0 @@
-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
deleted file mode 100644
index 55f3ead7c6..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/parentChange3.qml
+++ /dev/null
@@ -1,42 +0,0 @@
-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
deleted file mode 100644
index ae05b05072..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/parentChange4.qml
+++ /dev/null
@@ -1,30 +0,0 @@
-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
deleted file mode 100644
index 32a0b91cd9..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/parentChange5.qml
+++ /dev/null
@@ -1,30 +0,0 @@
-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
deleted file mode 100644
index 70ad894ffc..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/parentChange6.qml
+++ /dev/null
@@ -1,30 +0,0 @@
-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
deleted file mode 100644
index 3ab3c3252e..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/propertyErrors.qml
+++ /dev/null
@@ -1,10 +0,0 @@
-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
deleted file mode 100644
index a140ffab4d..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/reset.qml
+++ /dev/null
@@ -1,19 +0,0 @@
-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
deleted file mode 100644
index dfd7c1794a..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/restoreEntryValues.qml
+++ /dev/null
@@ -1,14 +0,0 @@
-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
deleted file mode 100644
index a0d053cf03..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/returnToBase.qml
+++ /dev/null
@@ -1,21 +0,0 @@
-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
deleted file mode 100644
index 630aaf0ffa..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/script.qml
+++ /dev/null
@@ -1,10 +0,0 @@
-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
deleted file mode 100644
index 0eaf547644..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/signalOverride.qml
+++ /dev/null
@@ -1,18 +0,0 @@
-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
deleted file mode 100644
index ef26ff14e7..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/signalOverride2.qml
+++ /dev/null
@@ -1,9 +0,0 @@
-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
deleted file mode 100644
index 8e9b698383..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/signalOverrideCrash.qml
+++ /dev/null
@@ -1,15 +0,0 @@
-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
deleted file mode 100644
index 74df9430c3..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/signalOverrideCrash2.qml
+++ /dev/null
@@ -1,24 +0,0 @@
-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/signalOverrideCrash3.qml b/tests/auto/qtquick1/qdeclarativestates/data/signalOverrideCrash3.qml
deleted file mode 100644
index ed1f22f39a..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/signalOverrideCrash3.qml
+++ /dev/null
@@ -1,27 +0,0 @@
-import QtQuick 1.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/qtquick1/qdeclarativestates/data/unnamedWhen.qml b/tests/auto/qtquick1/qdeclarativestates/data/unnamedWhen.qml
deleted file mode 100644
index 4425b4dd49..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/unnamedWhen.qml
+++ /dev/null
@@ -1,14 +0,0 @@
-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
deleted file mode 100644
index 743f5404b0..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/urlResolution.qml
+++ /dev/null
@@ -1,12 +0,0 @@
-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
deleted file mode 100644
index 48aef5a6ce..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/data/whenOrdering.qml
+++ /dev/null
@@ -1,11 +0,0 @@
-import QtQuick 1.0
-
-Rectangle {
- property bool condition1: false
- property bool condition2: false
-
- states: [
- State { name: "state1"; when: condition1 },
- State { name: "state2"; when: condition2 }
- ]
-}
diff --git a/tests/auto/qtquick1/qdeclarativestates/qdeclarativestates.pro b/tests/auto/qtquick1/qdeclarativestates/qdeclarativestates.pro
deleted file mode 100644
index 1c9a58647f..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/qdeclarativestates.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qdeclarativestates
-macx:CONFIG -= app_bundle
-
-SOURCES += tst_qdeclarativestates.cpp
-
-DEFINES += SRCDIR=\\\"$$PWD\\\"
-
-CONFIG += parallel_test
-QT += core-private gui-private widgets-private v8-private declarative-private qtquick1-private testlib
diff --git a/tests/auto/qtquick1/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/qtquick1/qdeclarativestates/tst_qdeclarativestates.cpp
deleted file mode 100644
index 2d5731bc8e..0000000000
--- a/tests/auto/qtquick1/qdeclarativestates/tst_qdeclarativestates.cpp
+++ /dev/null
@@ -1,1526 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <qtest.h>
-#include <QtDeclarative/qdeclarativeengine.h>
-#include <QtDeclarative/qdeclarativecomponent.h>
-#include <QtQuick1/private/qdeclarativeanchors_p_p.h>
-#include <QtQuick1/private/qdeclarativerectangle_p.h>
-#include <QtQuick1/private/qdeclarativeimage_p.h>
-#include <QtQuick1/private/qdeclarativepropertychanges_p.h>
-#include <QtQuick1/private/qdeclarativestategroup_p.h>
-#include <QtQuick1/private/qdeclarativeitem_p.h>
-#include <private/qdeclarativeproperty_p.h>
-
-class MyAttached : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(int foo READ foo WRITE setFoo)
-public:
- MyAttached(QObject *parent) : QObject(parent), m_foo(13) {}
-
- int foo() const { return m_foo; }
- void setFoo(int f) { m_foo = f; }
-
-private:
- int m_foo;
-};
-
-class MyRect : public QDeclarative1Rectangle
-{
- Q_OBJECT
- Q_PROPERTY(int propertyWithNotify READ propertyWithNotify WRITE setPropertyWithNotify NOTIFY oddlyNamedNotifySignal)
-public:
- MyRect() {}
-
- void doSomething() { emit didSomething(); }
-
- int propertyWithNotify() const { return m_prop; }
- void setPropertyWithNotify(int i) { m_prop = i; emit oddlyNamedNotifySignal(); }
-
- static MyAttached *qmlAttachedProperties(QObject *o) {
- return new MyAttached(o);
- }
-Q_SIGNALS:
- void didSomething();
- void oddlyNamedNotifySignal();
-
-private:
- int m_prop;
-};
-
-QML_DECLARE_TYPE(MyRect)
-QML_DECLARE_TYPEINFO(MyRect, QML_HAS_ATTACHED_PROPERTIES)
-
-class tst_qdeclarativestates : public QObject
-{
- Q_OBJECT
-public:
- tst_qdeclarativestates() {}
-
-private:
- static QByteArray fullDataPath(const QString &path);
-
-private slots:
- void initTestCase();
-
- void basicChanges();
- void attachedPropertyChanges();
- void basicExtension();
- void basicBinding();
- void signalOverride();
- void signalOverrideCrash();
- void signalOverrideCrash2();
- void signalOverrideCrash3();
- void parentChange();
- void parentChangeErrors();
- void anchorChanges();
- void anchorChanges2();
- void anchorChanges3();
- void anchorChanges4();
- void anchorChanges5();
- void anchorChangesRTL();
- void anchorChangesRTL2();
- void anchorChangesRTL3();
- void anchorChangesCrash();
- void anchorRewindBug();
- void anchorRewindBug2();
- void script();
- void restoreEntryValues();
- void explicitChanges();
- void propertyErrors();
- void incorrectRestoreBug();
- void autoStateAtStartupRestoreBug();
- void deletingChange();
- void deletingState();
- void tempState();
- void illegalTempState();
- void nonExistantProperty();
- void reset();
- void illegalObjectCreation();
- void whenOrdering();
- void urlResolution();
- void unnamedWhen();
- void returnToBase();
- void extendsBug();
- void editProperties();
- void QTBUG_14830();
-};
-
-void tst_qdeclarativestates::initTestCase()
-{
- qmlRegisterType<MyRect>("Qt.test", 1, 0, "MyRectangle");
-}
-
-QByteArray tst_qdeclarativestates::fullDataPath(const QString &path)
-{
- return QUrl::fromLocalFile(SRCDIR + path).toString().toUtf8();
-}
-
-void tst_qdeclarativestates::basicChanges()
-{
- QDeclarativeEngine engine;
-
- {
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicChanges.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
- QVERIFY(rect != 0);
-
- QCOMPARE(rect->color(),QColor("red"));
-
- rectPrivate->setState("blue");
- QCOMPARE(rect->color(),QColor("blue"));
-
- rectPrivate->setState("");
- QCOMPARE(rect->color(),QColor("red"));
- }
-
- {
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicChanges2.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
- QVERIFY(rect != 0);
-
- QCOMPARE(rect->color(),QColor("red"));
-
- rectPrivate->setState("blue");
- QCOMPARE(rect->color(),QColor("blue"));
-
- rectPrivate->setState("green");
- QCOMPARE(rect->color(),QColor("green"));
-
- rectPrivate->setState("");
- QCOMPARE(rect->color(),QColor("red"));
-
- rectPrivate->setState("green");
- QCOMPARE(rect->color(),QColor("green"));
- }
-
- {
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicChanges3.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
- QVERIFY(rect != 0);
-
- QCOMPARE(rect->color(),QColor("red"));
- QCOMPARE(rect->border()->width(),1);
-
- rectPrivate->setState("blue");
- QCOMPARE(rect->color(),QColor("blue"));
- QCOMPARE(rect->border()->width(),1);
-
- rectPrivate->setState("bordered");
- QCOMPARE(rect->color(),QColor("red"));
- QCOMPARE(rect->border()->width(),2);
-
- rectPrivate->setState("");
- QCOMPARE(rect->color(),QColor("red"));
- QCOMPARE(rect->border()->width(),1);
- //### we should be checking that this is an implicit rather than explicit 1 (which currently fails)
-
- rectPrivate->setState("bordered");
- QCOMPARE(rect->color(),QColor("red"));
- QCOMPARE(rect->border()->width(),2);
-
- rectPrivate->setState("blue");
- QCOMPARE(rect->color(),QColor("blue"));
- QCOMPARE(rect->border()->width(),1);
-
- }
-
- {
- // Test basicChanges4.qml can magically connect to propertyWithNotify's notify
- // signal using 'onPropertyWithNotifyChanged' even though the signal name is
- // actually 'oddlyNamedNotifySignal'
-
- QDeclarativeComponent component(&engine, SRCDIR "/data/basicChanges4.qml");
- QVERIFY(component.isReady());
-
- MyRect *rect = qobject_cast<MyRect*>(component.create());
- QVERIFY(rect != 0);
-
- QMetaProperty prop = rect->metaObject()->property(rect->metaObject()->indexOfProperty("propertyWithNotify"));
- QVERIFY(prop.hasNotifySignal());
- QString notifySignal = QByteArray(prop.notifySignal().signature());
- QVERIFY(!notifySignal.startsWith("propertyWithNotifyChanged("));
-
- QCOMPARE(rect->color(), QColor(Qt::red));
-
- rect->setPropertyWithNotify(100);
- QCOMPARE(rect->color(), QColor(Qt::blue));
- }
-}
-
-void tst_qdeclarativestates::attachedPropertyChanges()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent component(&engine, SRCDIR "/data/attachedPropertyChanges.qml");
- QVERIFY(component.isReady());
-
- QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create());
- QVERIFY(item != 0);
- QCOMPARE(item->width(), 50.0);
-
- // Ensure attached property has been changed
- QObject *attObj = qmlAttachedPropertiesObject<MyRect>(item, false);
- QVERIFY(attObj);
-
- MyAttached *att = qobject_cast<MyAttached*>(attObj);
- QVERIFY(att);
-
- QCOMPARE(att->foo(), 1);
-}
-
-void tst_qdeclarativestates::basicExtension()
-{
- QDeclarativeEngine engine;
-
- {
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicExtension.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
- QVERIFY(rect != 0);
-
- QCOMPARE(rect->color(),QColor("red"));
- QCOMPARE(rect->border()->width(),1);
-
- rectPrivate->setState("blue");
- QCOMPARE(rect->color(),QColor("blue"));
- QCOMPARE(rect->border()->width(),1);
-
- rectPrivate->setState("bordered");
- QCOMPARE(rect->color(),QColor("blue"));
- QCOMPARE(rect->border()->width(),2);
-
- rectPrivate->setState("blue");
- QCOMPARE(rect->color(),QColor("blue"));
- QCOMPARE(rect->border()->width(),1);
-
- rectPrivate->setState("");
- QCOMPARE(rect->color(),QColor("red"));
- QCOMPARE(rect->border()->width(),1);
-
- rectPrivate->setState("bordered");
- QCOMPARE(rect->color(),QColor("blue"));
- QCOMPARE(rect->border()->width(),2);
-
- rectPrivate->setState("");
- QCOMPARE(rect->color(),QColor("red"));
- QCOMPARE(rect->border()->width(),1);
- }
-
- {
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/fakeExtension.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
- QVERIFY(rect != 0);
-
- QCOMPARE(rect->color(),QColor("red"));
-
- rectPrivate->setState("blue");
- QCOMPARE(rect->color(),QColor("blue"));
-
- rectPrivate->setState("green");
- QCOMPARE(rect->color(),QColor("green"));
-
- rectPrivate->setState("blue");
- QCOMPARE(rect->color(),QColor("blue"));
-
- rectPrivate->setState("green");
- QCOMPARE(rect->color(),QColor("green"));
-
- rectPrivate->setState("");
- QCOMPARE(rect->color(),QColor("red"));
-
- rectPrivate->setState("green");
- QCOMPARE(rect->color(),QColor("green"));
- }
-}
-
-void tst_qdeclarativestates::basicBinding()
-{
- QDeclarativeEngine engine;
-
- {
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicBinding.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
- QVERIFY(rect != 0);
-
- QCOMPARE(rect->color(),QColor("red"));
-
- rectPrivate->setState("blue");
- QCOMPARE(rect->color(),QColor("blue"));
-
- rectPrivate->setState("");
- QCOMPARE(rect->color(),QColor("red"));
-
- rectPrivate->setState("blue");
- QCOMPARE(rect->color(),QColor("blue"));
- rect->setProperty("sourceColor", QColor("green"));
- QCOMPARE(rect->color(),QColor("green"));
-
- rectPrivate->setState("");
- QCOMPARE(rect->color(),QColor("red"));
- rect->setProperty("sourceColor", QColor("yellow"));
- QCOMPARE(rect->color(),QColor("red"));
-
- rectPrivate->setState("blue");
- QCOMPARE(rect->color(),QColor("yellow"));
- }
-
- {
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicBinding2.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
- QVERIFY(rect != 0);
-
- QCOMPARE(rect->color(),QColor("red"));
-
- rectPrivate->setState("blue");
- QCOMPARE(rect->color(),QColor("blue"));
-
- rectPrivate->setState("");
- QCOMPARE(rect->color(),QColor("red"));
-
- rectPrivate->setState("blue");
- QCOMPARE(rect->color(),QColor("blue"));
- rect->setProperty("sourceColor", QColor("green"));
- QCOMPARE(rect->color(),QColor("blue"));
-
- rectPrivate->setState("");
- QCOMPARE(rect->color(),QColor("green"));
- rect->setProperty("sourceColor", QColor("yellow"));
- QCOMPARE(rect->color(),QColor("yellow"));
-
- rectPrivate->setState("blue");
- QCOMPARE(rect->color(),QColor("blue"));
-
- rectPrivate->setState("");
- QCOMPARE(rect->color(),QColor("yellow"));
- }
-
- {
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicBinding3.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
- QVERIFY(rect != 0);
-
- QCOMPARE(rect->color(),QColor("red"));
- rect->setProperty("sourceColor", QColor("green"));
- QCOMPARE(rect->color(),QColor("green"));
-
- rectPrivate->setState("blue");
- QCOMPARE(rect->color(),QColor("blue"));
- rect->setProperty("sourceColor", QColor("red"));
- QCOMPARE(rect->color(),QColor("blue"));
- rect->setProperty("sourceColor2", QColor("yellow"));
- QCOMPARE(rect->color(),QColor("yellow"));
-
- rectPrivate->setState("");
- QCOMPARE(rect->color(),QColor("red"));
- rect->setProperty("sourceColor2", QColor("green"));
- QCOMPARE(rect->color(),QColor("red"));
- rect->setProperty("sourceColor", QColor("yellow"));
- QCOMPARE(rect->color(),QColor("yellow"));
- }
-
- {
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicBinding4.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
- QVERIFY(rect != 0);
-
- QCOMPARE(rect->color(),QColor("red"));
-
- rectPrivate->setState("blue");
- QCOMPARE(rect->color(),QColor("blue"));
- rect->setProperty("sourceColor", QColor("yellow"));
- QCOMPARE(rect->color(),QColor("yellow"));
-
- rectPrivate->setState("green");
- QCOMPARE(rect->color(),QColor("green"));
- rect->setProperty("sourceColor", QColor("purple"));
- QCOMPARE(rect->color(),QColor("green"));
-
- rectPrivate->setState("blue");
- QCOMPARE(rect->color(),QColor("purple"));
-
- rectPrivate->setState("green");
- QCOMPARE(rect->color(),QColor("green"));
-
- rectPrivate->setState("");
- QCOMPARE(rect->color(),QColor("red"));
- }
-}
-
-void tst_qdeclarativestates::signalOverride()
-{
- QDeclarativeEngine engine;
-
- {
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/signalOverride.qml");
- MyRect *rect = qobject_cast<MyRect*>(rectComponent.create());
- QVERIFY(rect != 0);
-
- QCOMPARE(rect->color(),QColor("red"));
- rect->doSomething();
- QCOMPARE(rect->color(),QColor("blue"));
-
- QDeclarativeItemPrivate::get(rect)->setState("green");
- rect->doSomething();
- QCOMPARE(rect->color(),QColor("green"));
- }
-
- {
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/signalOverride2.qml");
- MyRect *rect = qobject_cast<MyRect*>(rectComponent.create());
- QVERIFY(rect != 0);
-
- QCOMPARE(rect->color(),QColor("white"));
- rect->doSomething();
- QCOMPARE(rect->color(),QColor("blue"));
-
- QDeclarative1Rectangle *innerRect = qobject_cast<QDeclarative1Rectangle*>(rect->findChild<QDeclarative1Rectangle*>("extendedRect"));
- QDeclarativeItemPrivate::get(innerRect)->setState("green");
- rect->doSomething();
- QCOMPARE(rect->color(),QColor("blue"));
- QCOMPARE(innerRect->color(),QColor("green"));
- QCOMPARE(innerRect->property("extendedColor").value<QColor>(),QColor("green"));
- }
-}
-
-void tst_qdeclarativestates::signalOverrideCrash()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/signalOverrideCrash.qml");
- MyRect *rect = qobject_cast<MyRect*>(rectComponent.create());
- QVERIFY(rect != 0);
-
- QDeclarativeItemPrivate::get(rect)->setState("overridden");
- rect->doSomething();
-}
-
-void tst_qdeclarativestates::signalOverrideCrash2()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/signalOverrideCrash2.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
-
- QDeclarativeItemPrivate::get(rect)->setState("state1");
- QDeclarativeItemPrivate::get(rect)->setState("state2");
- QDeclarativeItemPrivate::get(rect)->setState("state1");
-
- delete rect;
-}
-
-void tst_qdeclarativestates::signalOverrideCrash3()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/signalOverrideCrash3.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
-
- QDeclarativeItemPrivate::get(rect)->setState("state1");
- QDeclarativeItemPrivate::get(rect)->setState("");
- QDeclarativeItemPrivate::get(rect)->setState("state2");
- QDeclarativeItemPrivate::get(rect)->setState("");
-
- delete rect;
-}
-
-void tst_qdeclarativestates::parentChange()
-{
- QDeclarativeEngine engine;
-
- {
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange1.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
-
- QDeclarative1Rectangle *innerRect = qobject_cast<QDeclarative1Rectangle*>(rect->findChild<QDeclarative1Rectangle*>("MyRect"));
- QVERIFY(innerRect != 0);
-
- QDeclarativeListReference list(rect, "states");
- QDeclarative1State *state = qobject_cast<QDeclarative1State*>(list.at(0));
- QVERIFY(state != 0);
-
- qmlExecuteDeferred(state);
- QDeclarative1ParentChange *pChange = qobject_cast<QDeclarative1ParentChange*>(state->operationAt(0));
- QVERIFY(pChange != 0);
- QDeclarativeItem *nParent = qobject_cast<QDeclarativeItem*>(rect->findChild<QDeclarativeItem*>("NewParent"));
- QVERIFY(nParent != 0);
-
- QCOMPARE(pChange->parent(), nParent);
-
- QDeclarativeItemPrivate::get(rect)->setState("reparented");
- QCOMPARE(innerRect->rotation(), qreal(0));
- QCOMPARE(innerRect->scale(), qreal(1));
- QCOMPARE(innerRect->x(), qreal(-133));
- QCOMPARE(innerRect->y(), qreal(-300));
- }
-
- {
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange2.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
- QDeclarative1Rectangle *innerRect = qobject_cast<QDeclarative1Rectangle*>(rect->findChild<QDeclarative1Rectangle*>("MyRect"));
- QVERIFY(innerRect != 0);
-
- rectPrivate->setState("reparented");
- QCOMPARE(innerRect->rotation(), qreal(15));
- QCOMPARE(innerRect->scale(), qreal(.5));
- QCOMPARE(QString("%1").arg(innerRect->x()), QString("%1").arg(-19.9075));
- QCOMPARE(QString("%1").arg(innerRect->y()), QString("%1").arg(-8.73433));
- }
-
- {
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange3.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
- QDeclarative1Rectangle *innerRect = qobject_cast<QDeclarative1Rectangle*>(rect->findChild<QDeclarative1Rectangle*>("MyRect"));
- QVERIFY(innerRect != 0);
-
- rectPrivate->setState("reparented");
- QCOMPARE(innerRect->rotation(), qreal(-37));
- QCOMPARE(innerRect->scale(), qreal(.25));
- QCOMPARE(QString("%1").arg(innerRect->x()), QString("%1").arg(-217.305));
- QCOMPARE(QString("%1").arg(innerRect->y()), QString("%1").arg(-164.413));
-
- rectPrivate->setState("");
- QCOMPARE(innerRect->rotation(), qreal(0));
- QCOMPARE(innerRect->scale(), qreal(1));
- QCOMPARE(innerRect->x(), qreal(5));
- //do a non-qFuzzyCompare fuzzy compare
- QVERIFY(innerRect->y() < qreal(0.00001) && innerRect->y() > qreal(-0.00001));
- }
-
- {
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange6.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
-
- QDeclarative1Rectangle *innerRect = qobject_cast<QDeclarative1Rectangle*>(rect->findChild<QDeclarative1Rectangle*>("MyRect"));
- QVERIFY(innerRect != 0);
-
- QDeclarativeItemPrivate::get(rect)->setState("reparented");
- QCOMPARE(innerRect->rotation(), qreal(180));
- QCOMPARE(innerRect->scale(), qreal(1));
- QCOMPARE(innerRect->x(), qreal(-105));
- QCOMPARE(innerRect->y(), qreal(-105));
- }
-}
-
-void tst_qdeclarativestates::parentChangeErrors()
-{
- QDeclarativeEngine engine;
-
- {
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange4.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
-
- QDeclarative1Rectangle *innerRect = qobject_cast<QDeclarative1Rectangle*>(rect->findChild<QDeclarative1Rectangle*>("MyRect"));
- QVERIFY(innerRect != 0);
-
- QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/parentChange4.qml") + ":25:9: QML ParentChange: Unable to preserve appearance under non-uniform scale");
- QDeclarativeItemPrivate::get(rect)->setState("reparented");
- QCOMPARE(innerRect->rotation(), qreal(0));
- QCOMPARE(innerRect->scale(), qreal(1));
- QCOMPARE(innerRect->x(), qreal(5));
- QCOMPARE(innerRect->y(), qreal(5));
- }
-
- {
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange5.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
-
- QDeclarative1Rectangle *innerRect = qobject_cast<QDeclarative1Rectangle*>(rect->findChild<QDeclarative1Rectangle*>("MyRect"));
- QVERIFY(innerRect != 0);
-
- QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/parentChange5.qml") + ":25:9: QML ParentChange: Unable to preserve appearance under complex transform");
- QDeclarativeItemPrivate::get(rect)->setState("reparented");
- QCOMPARE(innerRect->rotation(), qreal(0));
- QCOMPARE(innerRect->scale(), qreal(1));
- QCOMPARE(innerRect->x(), qreal(5));
- QCOMPARE(innerRect->y(), qreal(5));
- }
-}
-
-void tst_qdeclarativestates::anchorChanges()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges1.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
-
- QDeclarative1Rectangle *innerRect = qobject_cast<QDeclarative1Rectangle*>(rect->findChild<QDeclarative1Rectangle*>("MyRect"));
- QVERIFY(innerRect != 0);
-
- QDeclarativeListReference list(rect, "states");
- QDeclarative1State *state = qobject_cast<QDeclarative1State*>(list.at(0));
- QVERIFY(state != 0);
-
- qmlExecuteDeferred(state);
- QDeclarative1AnchorChanges *aChanges = qobject_cast<QDeclarative1AnchorChanges*>(state->operationAt(0));
- QVERIFY(aChanges != 0);
-
- rectPrivate->setState("right");
- QCOMPARE(innerRect->x(), qreal(150));
- QCOMPARE(aChanges->object(), qobject_cast<QDeclarativeItem*>(innerRect));
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->left().anchorLine, QDeclarative1AnchorLine::Invalid); //### was reset (how do we distinguish from not set at all)
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->right().item, rectPrivate->right().item);
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->right().anchorLine, rectPrivate->right().anchorLine);
-
- rectPrivate->setState("");
- QCOMPARE(innerRect->x(), qreal(5));
-
- delete rect;
-}
-
-void tst_qdeclarativestates::anchorChanges2()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges2.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
-
- QDeclarative1Rectangle *innerRect = qobject_cast<QDeclarative1Rectangle*>(rect->findChild<QDeclarative1Rectangle*>("MyRect"));
- QVERIFY(innerRect != 0);
-
- rectPrivate->setState("right");
- QCOMPARE(innerRect->x(), qreal(150));
-
- rectPrivate->setState("");
- QCOMPARE(innerRect->x(), qreal(5));
-
- delete rect;
-}
-
-void tst_qdeclarativestates::anchorChanges3()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges3.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
-
- QDeclarative1Rectangle *innerRect = qobject_cast<QDeclarative1Rectangle*>(rect->findChild<QDeclarative1Rectangle*>("MyRect"));
- QVERIFY(innerRect != 0);
-
- QDeclarativeItem *leftGuideline = qobject_cast<QDeclarativeItem*>(rect->findChild<QDeclarativeItem*>("LeftGuideline"));
- QVERIFY(leftGuideline != 0);
-
- QDeclarativeItem *bottomGuideline = qobject_cast<QDeclarativeItem*>(rect->findChild<QDeclarativeItem*>("BottomGuideline"));
- QVERIFY(bottomGuideline != 0);
-
- QDeclarativeListReference list(rect, "states");
- QDeclarative1State *state = qobject_cast<QDeclarative1State*>(list.at(0));
- QVERIFY(state != 0);
-
- qmlExecuteDeferred(state);
- QDeclarative1AnchorChanges *aChanges = qobject_cast<QDeclarative1AnchorChanges*>(state->operationAt(0));
- QVERIFY(aChanges != 0);
-
- rectPrivate->setState("reanchored");
- QCOMPARE(aChanges->object(), qobject_cast<QDeclarativeItem*>(innerRect));
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->left().item, QDeclarativeItemPrivate::get(leftGuideline)->left().item);
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->left().anchorLine, QDeclarativeItemPrivate::get(leftGuideline)->left().anchorLine);
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->right().item, rectPrivate->right().item);
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->right().anchorLine, rectPrivate->right().anchorLine);
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->top().item, rectPrivate->top().item);
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->top().anchorLine, rectPrivate->top().anchorLine);
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->bottom().item, QDeclarativeItemPrivate::get(bottomGuideline)->bottom().item);
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->bottom().anchorLine, QDeclarativeItemPrivate::get(bottomGuideline)->bottom().anchorLine);
-
- QCOMPARE(innerRect->x(), qreal(10));
- QCOMPARE(innerRect->y(), qreal(0));
- QCOMPARE(innerRect->width(), qreal(190));
- QCOMPARE(innerRect->height(), qreal(150));
-
- rectPrivate->setState("");
- QCOMPARE(innerRect->x(), qreal(0));
- QCOMPARE(innerRect->y(), qreal(10));
- QCOMPARE(innerRect->width(), qreal(150));
- QCOMPARE(innerRect->height(), qreal(190));
-
- delete rect;
-}
-
-void tst_qdeclarativestates::anchorChanges4()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges4.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
-
- QDeclarative1Rectangle *innerRect = qobject_cast<QDeclarative1Rectangle*>(rect->findChild<QDeclarative1Rectangle*>("MyRect"));
- QVERIFY(innerRect != 0);
-
- QDeclarativeItem *leftGuideline = qobject_cast<QDeclarativeItem*>(rect->findChild<QDeclarativeItem*>("LeftGuideline"));
- QVERIFY(leftGuideline != 0);
-
- QDeclarativeItem *bottomGuideline = qobject_cast<QDeclarativeItem*>(rect->findChild<QDeclarativeItem*>("BottomGuideline"));
- QVERIFY(bottomGuideline != 0);
-
- QDeclarativeListReference list(rect, "states");
- QDeclarative1State *state = qobject_cast<QDeclarative1State*>(list.at(0));
- QVERIFY(state != 0);
-
- qmlExecuteDeferred(state);
- QDeclarative1AnchorChanges *aChanges = qobject_cast<QDeclarative1AnchorChanges*>(state->operationAt(0));
- QVERIFY(aChanges != 0);
-
- QDeclarativeItemPrivate::get(rect)->setState("reanchored");
- QCOMPARE(aChanges->object(), qobject_cast<QDeclarativeItem*>(innerRect));
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->horizontalCenter().item, QDeclarativeItemPrivate::get(bottomGuideline)->horizontalCenter().item);
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->horizontalCenter().anchorLine, QDeclarativeItemPrivate::get(bottomGuideline)->horizontalCenter().anchorLine);
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->verticalCenter().item, QDeclarativeItemPrivate::get(leftGuideline)->verticalCenter().item);
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->verticalCenter().anchorLine, QDeclarativeItemPrivate::get(leftGuideline)->verticalCenter().anchorLine);
-
- delete rect;
-}
-
-void tst_qdeclarativestates::anchorChanges5()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges5.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
-
- QDeclarative1Rectangle *innerRect = qobject_cast<QDeclarative1Rectangle*>(rect->findChild<QDeclarative1Rectangle*>("MyRect"));
- QVERIFY(innerRect != 0);
-
- QDeclarativeItem *leftGuideline = qobject_cast<QDeclarativeItem*>(rect->findChild<QDeclarativeItem*>("LeftGuideline"));
- QVERIFY(leftGuideline != 0);
-
- QDeclarativeItem *bottomGuideline = qobject_cast<QDeclarativeItem*>(rect->findChild<QDeclarativeItem*>("BottomGuideline"));
- QVERIFY(bottomGuideline != 0);
-
- QDeclarativeListReference list(rect, "states");
- QDeclarative1State *state = qobject_cast<QDeclarative1State*>(list.at(0));
- QVERIFY(state != 0);
-
- qmlExecuteDeferred(state);
- QDeclarative1AnchorChanges *aChanges = qobject_cast<QDeclarative1AnchorChanges*>(state->operationAt(0));
- QVERIFY(aChanges != 0);
-
- QDeclarativeItemPrivate::get(rect)->setState("reanchored");
- QCOMPARE(aChanges->object(), qobject_cast<QDeclarativeItem*>(innerRect));
- //QCOMPARE(aChanges->anchors()->horizontalCenter().item, bottomGuideline->horizontalCenter().item);
- //QCOMPARE(aChanges->anchors()->horizontalCenter().anchorLine, bottomGuideline->horizontalCenter().anchorLine);
- //QCOMPARE(aChanges->anchors()->baseline().item, leftGuideline->baseline().item);
- //QCOMPARE(aChanges->anchors()->baseline().anchorLine, leftGuideline->baseline().anchorLine);
-
- delete rect;
-}
-
-void mirrorAnchors(QDeclarativeItem *item) {
- QDeclarativeItemPrivate *itemPrivate = QDeclarativeItemPrivate::get(item);
- itemPrivate->setLayoutMirror(true);
-}
-
-qreal offsetRTL(QDeclarativeItem *anchorItem, QDeclarativeItem *item) {
- return anchorItem->width()+2*anchorItem->x()-item->width();
-}
-
-void tst_qdeclarativestates::anchorChangesRTL()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges1.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
-
- QDeclarative1Rectangle *innerRect = qobject_cast<QDeclarative1Rectangle*>(rect->findChild<QDeclarative1Rectangle*>("MyRect"));
- QVERIFY(innerRect != 0);
- mirrorAnchors(innerRect);
-
- QDeclarativeListReference list(rect, "states");
- QDeclarative1State *state = qobject_cast<QDeclarative1State*>(list.at(0));
- QVERIFY(state != 0);
-
- qmlExecuteDeferred(state);
- QDeclarative1AnchorChanges *aChanges = qobject_cast<QDeclarative1AnchorChanges*>(state->operationAt(0));
- QVERIFY(aChanges != 0);
-
- rectPrivate->setState("right");
- QCOMPARE(innerRect->x(), offsetRTL(rect, innerRect) - qreal(150));
- QCOMPARE(aChanges->object(), qobject_cast<QDeclarativeItem*>(innerRect));
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->left().anchorLine, QDeclarative1AnchorLine::Invalid); //### was reset (how do we distinguish from not set at all)
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->right().item, rectPrivate->right().item);
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->right().anchorLine, rectPrivate->right().anchorLine);
-
- rectPrivate->setState("");
- QCOMPARE(innerRect->x(), offsetRTL(rect, innerRect) -qreal(5));
-
- delete rect;
-}
-
-void tst_qdeclarativestates::anchorChangesRTL2()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges2.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
-
- QDeclarative1Rectangle *innerRect = qobject_cast<QDeclarative1Rectangle*>(rect->findChild<QDeclarative1Rectangle*>("MyRect"));
- QVERIFY(innerRect != 0);
- mirrorAnchors(innerRect);
-
- rectPrivate->setState("right");
- QCOMPARE(innerRect->x(), offsetRTL(rect, innerRect) - qreal(150));
-
- rectPrivate->setState("");
- QCOMPARE(innerRect->x(), offsetRTL(rect, innerRect) - qreal(5));
-
- delete rect;
-}
-
-void tst_qdeclarativestates::anchorChangesRTL3()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges3.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
-
- QDeclarative1Rectangle *innerRect = qobject_cast<QDeclarative1Rectangle*>(rect->findChild<QDeclarative1Rectangle*>("MyRect"));
- QVERIFY(innerRect != 0);
- mirrorAnchors(innerRect);
-
- QDeclarativeItem *leftGuideline = qobject_cast<QDeclarativeItem*>(rect->findChild<QDeclarativeItem*>("LeftGuideline"));
- QVERIFY(leftGuideline != 0);
-
- QDeclarativeItem *bottomGuideline = qobject_cast<QDeclarativeItem*>(rect->findChild<QDeclarativeItem*>("BottomGuideline"));
- QVERIFY(bottomGuideline != 0);
-
- QDeclarativeListReference list(rect, "states");
- QDeclarative1State *state = qobject_cast<QDeclarative1State*>(list.at(0));
- QVERIFY(state != 0);
-
- qmlExecuteDeferred(state);
- QDeclarative1AnchorChanges *aChanges = qobject_cast<QDeclarative1AnchorChanges*>(state->operationAt(0));
- QVERIFY(aChanges != 0);
-
- rectPrivate->setState("reanchored");
- QCOMPARE(aChanges->object(), qobject_cast<QDeclarativeItem*>(innerRect));
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->left().item, QDeclarativeItemPrivate::get(leftGuideline)->left().item);
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->left().anchorLine, QDeclarativeItemPrivate::get(leftGuideline)->left().anchorLine);
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->right().item, rectPrivate->right().item);
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->right().anchorLine, rectPrivate->right().anchorLine);
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->top().item, rectPrivate->top().item);
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->top().anchorLine, rectPrivate->top().anchorLine);
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->bottom().item, QDeclarativeItemPrivate::get(bottomGuideline)->bottom().item);
- QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->bottom().anchorLine, QDeclarativeItemPrivate::get(bottomGuideline)->bottom().anchorLine);
-
- QCOMPARE(innerRect->x(), offsetRTL(leftGuideline, innerRect) - qreal(10));
- QCOMPARE(innerRect->y(), qreal(0));
- // between left side of parent and leftGuideline.x: 10, which has width 0
- QCOMPARE(innerRect->width(), qreal(10));
- QCOMPARE(innerRect->height(), qreal(150));
-
- rectPrivate->setState("");
- QCOMPARE(innerRect->x(), offsetRTL(rect, innerRect) - qreal(0));
- QCOMPARE(innerRect->y(), qreal(10));
- // between right side of parent and left side of rightGuideline.x: 150, which has width 0
- QCOMPARE(innerRect->width(), qreal(50));
- QCOMPARE(innerRect->height(), qreal(190));
-
- delete rect;
-}
-
-//QTBUG-9609
-void tst_qdeclarativestates::anchorChangesCrash()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChangesCrash.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
-
- QDeclarativeItemPrivate::get(rect)->setState("reanchored");
-
- delete rect;
-}
-
-// QTBUG-12273
-void tst_qdeclarativestates::anchorRewindBug()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorRewindBug.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
-
- QDeclarativeItem * column = rect->findChild<QDeclarativeItem*>("column");
-
- QVERIFY(column != 0);
- QVERIFY(!QDeclarativeItemPrivate::get(column)->heightValid);
- QVERIFY(!QDeclarativeItemPrivate::get(column)->widthValid);
- QCOMPARE(column->height(), 200.0);
- QDeclarativeItemPrivate::get(rect)->setState("reanchored");
-
- // column height and width should stay implicit
- // and column's implicit resizing should still work
- QVERIFY(!QDeclarativeItemPrivate::get(column)->heightValid);
- QVERIFY(!QDeclarativeItemPrivate::get(column)->widthValid);
- QCOMPARE(column->height(), 100.0);
-
- QDeclarativeItemPrivate::get(rect)->setState("");
-
- // column height and width should stay implicit
- // and column's implicit resizing should still work
- QVERIFY(!QDeclarativeItemPrivate::get(column)->heightValid);
- QVERIFY(!QDeclarativeItemPrivate::get(column)->widthValid);
- QCOMPARE(column->height(), 200.0);
-
- delete rect;
-}
-
-// QTBUG-11834
-void tst_qdeclarativestates::anchorRewindBug2()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorRewindBug2.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
-
- QDeclarative1Rectangle *mover = rect->findChild<QDeclarative1Rectangle*>("mover");
-
- QVERIFY(mover != 0);
- QCOMPARE(mover->y(), qreal(0.0));
- QCOMPARE(mover->width(), qreal(50.0));
-
- QDeclarativeItemPrivate::get(rect)->setState("anchored");
- QCOMPARE(mover->y(), qreal(250.0));
- QCOMPARE(mover->width(), qreal(200.0));
-
- QDeclarativeItemPrivate::get(rect)->setState("");
- QCOMPARE(mover->y(), qreal(0.0));
- QCOMPARE(mover->width(), qreal(50.0));
-
- delete rect;
-}
-
-void tst_qdeclarativestates::script()
-{
- QDeclarativeEngine engine;
-
- {
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/script.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
- QCOMPARE(rect->color(),QColor("red"));
-
- rectPrivate->setState("blue");
- QCOMPARE(rect->color(),QColor("blue"));
-
- rectPrivate->setState("");
- QCOMPARE(rect->color(),QColor("blue")); // a script isn't reverted
- }
-}
-
-void tst_qdeclarativestates::restoreEntryValues()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/restoreEntryValues.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
- QCOMPARE(rect->color(),QColor("red"));
-
- rectPrivate->setState("blue");
- QCOMPARE(rect->color(),QColor("blue"));
-
- rectPrivate->setState("");
- QCOMPARE(rect->color(),QColor("blue"));
-}
-
-void tst_qdeclarativestates::explicitChanges()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/explicit.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
- QDeclarativeListReference list(rect, "states");
- QDeclarative1State *state = qobject_cast<QDeclarative1State*>(list.at(0));
- QVERIFY(state != 0);
-
- qmlExecuteDeferred(state);
- QDeclarative1PropertyChanges *changes = qobject_cast<QDeclarative1PropertyChanges*>(rect->findChild<QDeclarative1PropertyChanges*>("changes"));
- QVERIFY(changes != 0);
- QVERIFY(changes->isExplicit());
-
- QCOMPARE(rect->color(),QColor("red"));
-
- rectPrivate->setState("blue");
- QCOMPARE(rect->color(),QColor("blue"));
-
- rect->setProperty("sourceColor", QColor("green"));
- QCOMPARE(rect->color(),QColor("blue"));
-
- rectPrivate->setState("");
- QCOMPARE(rect->color(),QColor("red"));
- rect->setProperty("sourceColor", QColor("yellow"));
- QCOMPARE(rect->color(),QColor("red"));
-
- rectPrivate->setState("blue");
- QCOMPARE(rect->color(),QColor("yellow"));
-}
-
-void tst_qdeclarativestates::propertyErrors()
-{
- QDeclarativeEngine engine;
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/propertyErrors.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
-
- QCOMPARE(rect->color(),QColor("red"));
-
- QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/propertyErrors.qml") + ":8:9: QML PropertyChanges: Cannot assign to non-existent property \"colr\"");
- QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/propertyErrors.qml") + ":8:9: QML PropertyChanges: Cannot assign to read-only property \"activeFocus\"");
- QDeclarativeItemPrivate::get(rect)->setState("blue");
-}
-
-void tst_qdeclarativestates::incorrectRestoreBug()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicChanges.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
- QCOMPARE(rect->color(),QColor("red"));
-
- rectPrivate->setState("blue");
- QCOMPARE(rect->color(),QColor("blue"));
-
- rectPrivate->setState("");
- QCOMPARE(rect->color(),QColor("red"));
-
- // make sure if we change the base state value, we then restore to it correctly
- rect->setColor(QColor("green"));
-
- rectPrivate->setState("blue");
- QCOMPARE(rect->color(),QColor("blue"));
-
- rectPrivate->setState("");
- QCOMPARE(rect->color(),QColor("green"));
-}
-
-void tst_qdeclarativestates::autoStateAtStartupRestoreBug()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent component(&engine, SRCDIR "/data/autoStateAtStartupRestoreBug.qml");
- QObject *obj = component.create();
-
- QVERIFY(obj != 0);
- QCOMPARE(obj->property("test").toInt(), 3);
-
- obj->setProperty("input", 2);
-
- QCOMPARE(obj->property("test").toInt(), 9);
-
- delete obj;
-}
-
-void tst_qdeclarativestates::deletingChange()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/deleting.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
- rectPrivate->setState("blue");
- QCOMPARE(rect->color(),QColor("blue"));
- QCOMPARE(rect->radius(),qreal(5));
-
- rectPrivate->setState("");
- QCOMPARE(rect->color(),QColor("red"));
- QCOMPARE(rect->radius(),qreal(0));
-
- QDeclarative1PropertyChanges *pc = rect->findChild<QDeclarative1PropertyChanges*>("pc1");
- QVERIFY(pc != 0);
- delete pc;
-
- QDeclarative1State *state = rect->findChild<QDeclarative1State*>();
- QVERIFY(state != 0);
- qmlExecuteDeferred(state);
- QCOMPARE(state->operationCount(), 1);
-
- rectPrivate->setState("blue");
- QCOMPARE(rect->color(),QColor("red"));
- QCOMPARE(rect->radius(),qreal(5));
-
- delete rect;
-}
-
-void tst_qdeclarativestates::deletingState()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/deletingState.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
-
- QDeclarative1StateGroup *sg = rect->findChild<QDeclarative1StateGroup*>();
- QVERIFY(sg != 0);
- QVERIFY(sg->findState("blue") != 0);
-
- sg->setState("blue");
- QCOMPARE(rect->color(),QColor("blue"));
-
- sg->setState("");
- QCOMPARE(rect->color(),QColor("red"));
-
- QDeclarative1State *state = rect->findChild<QDeclarative1State*>();
- QVERIFY(state != 0);
- delete state;
-
- QVERIFY(sg->findState("blue") == 0);
-
- //### should we warn that state doesn't exist
- sg->setState("blue");
- QCOMPARE(rect->color(),QColor("red"));
-
- delete rect;
-}
-
-void tst_qdeclarativestates::tempState()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/legalTempState.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
- QTest::ignoreMessage(QtDebugMsg, "entering placed");
- QTest::ignoreMessage(QtDebugMsg, "entering idle");
- rectPrivate->setState("placed");
- QCOMPARE(rectPrivate->state(), QLatin1String("idle"));
-}
-
-void tst_qdeclarativestates::illegalTempState()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/illegalTempState.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML StateGroup: Can't apply a state change as part of a state definition.");
- rectPrivate->setState("placed");
- QCOMPARE(rectPrivate->state(), QLatin1String("placed"));
-}
-
-void tst_qdeclarativestates::nonExistantProperty()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/nonExistantProp.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(rectComponent.create());
- QVERIFY(rect != 0);
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
- QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/nonExistantProp.qml") + ":9:9: QML PropertyChanges: Cannot assign to non-existent property \"colr\"");
- rectPrivate->setState("blue");
- QCOMPARE(rectPrivate->state(), QLatin1String("blue"));
-}
-
-void tst_qdeclarativestates::reset()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent c(&engine, SRCDIR "/data/reset.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(c.create());
- QVERIFY(rect != 0);
-
- QDeclarative1Image *image = rect->findChild<QDeclarative1Image*>();
- QVERIFY(image != 0);
- QCOMPARE(image->width(), qreal(40.));
- QCOMPARE(image->height(), qreal(20.));
-
- QDeclarativeItemPrivate::get(rect)->setState("state1");
-
- QCOMPARE(image->width(), 20.0);
- QCOMPARE(image->height(), qreal(20.));
-}
-
-void tst_qdeclarativestates::illegalObjectCreation()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent component(&engine, SRCDIR "/data/illegalObj.qml");
- QList<QDeclarativeError> errors = component.errors();
- QVERIFY(errors.count() == 1);
- const QDeclarativeError &error = errors.at(0);
- QCOMPARE(error.line(), 9);
- QCOMPARE(error.column(), 23);
- QCOMPARE(error.description().toUtf8().constData(), "PropertyChanges does not support creating state-specific objects.");
-}
-
-void tst_qdeclarativestates::whenOrdering()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent c(&engine, SRCDIR "/data/whenOrdering.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(c.create());
- QVERIFY(rect != 0);
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
-
- QCOMPARE(rectPrivate->state(), QLatin1String(""));
- rect->setProperty("condition2", true);
- QCOMPARE(rectPrivate->state(), QLatin1String("state2"));
- rect->setProperty("condition1", true);
- QCOMPARE(rectPrivate->state(), QLatin1String("state1"));
- rect->setProperty("condition2", false);
- QCOMPARE(rectPrivate->state(), QLatin1String("state1"));
- rect->setProperty("condition2", true);
- QCOMPARE(rectPrivate->state(), QLatin1String("state1"));
- rect->setProperty("condition1", false);
- rect->setProperty("condition2", false);
- QCOMPARE(rectPrivate->state(), QLatin1String(""));
-}
-
-void tst_qdeclarativestates::urlResolution()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent c(&engine, SRCDIR "/data/urlResolution.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(c.create());
- QVERIFY(rect != 0);
-
- QDeclarativeItem *myType = rect->findChild<QDeclarativeItem*>("MyType");
- QDeclarative1Image *image1 = rect->findChild<QDeclarative1Image*>("image1");
- QDeclarative1Image *image2 = rect->findChild<QDeclarative1Image*>("image2");
- QDeclarative1Image *image3 = rect->findChild<QDeclarative1Image*>("image3");
- QVERIFY(myType != 0 && image1 != 0 && image2 != 0 && image3 != 0);
-
- QDeclarativeItemPrivate::get(myType)->setState("SetImageState");
- QUrl resolved = QUrl::fromLocalFile(SRCDIR "/data/Implementation/images/qt-logo.png");
- QCOMPARE(image1->source(), resolved);
- QCOMPARE(image2->source(), resolved);
- QCOMPARE(image3->source(), resolved);
-}
-
-void tst_qdeclarativestates::unnamedWhen()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent c(&engine, SRCDIR "/data/unnamedWhen.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(c.create());
- QVERIFY(rect != 0);
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
-
- QCOMPARE(rectPrivate->state(), QLatin1String(""));
- QCOMPARE(rect->property("stateString").toString(), QLatin1String(""));
- rect->setProperty("triggerState", true);
- QCOMPARE(rectPrivate->state(), QLatin1String("anonymousState1"));
- QCOMPARE(rect->property("stateString").toString(), QLatin1String("inState"));
- rect->setProperty("triggerState", false);
- QCOMPARE(rectPrivate->state(), QLatin1String(""));
- QCOMPARE(rect->property("stateString").toString(), QLatin1String(""));
-}
-
-void tst_qdeclarativestates::returnToBase()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent c(&engine, SRCDIR "/data/returnToBase.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(c.create());
- QVERIFY(rect != 0);
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
-
- QCOMPARE(rectPrivate->state(), QLatin1String(""));
- QCOMPARE(rect->property("stateString").toString(), QLatin1String(""));
- rect->setProperty("triggerState", true);
- QCOMPARE(rectPrivate->state(), QLatin1String("anonymousState1"));
- QCOMPARE(rect->property("stateString").toString(), QLatin1String("inState"));
- rect->setProperty("triggerState", false);
- QCOMPARE(rectPrivate->state(), QLatin1String(""));
- QCOMPARE(rect->property("stateString").toString(), QLatin1String("originalState"));
-}
-
-//QTBUG-12559
-void tst_qdeclarativestates::extendsBug()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent c(&engine, SRCDIR "/data/extendsBug.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(c.create());
- QVERIFY(rect != 0);
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
- QDeclarative1Rectangle *greenRect = rect->findChild<QDeclarative1Rectangle*>("greenRect");
-
- rectPrivate->setState("b");
- QCOMPARE(greenRect->x(), qreal(100));
- QCOMPARE(greenRect->y(), qreal(100));
-}
-
-void tst_qdeclarativestates::editProperties()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent c(&engine, SRCDIR "/data/editProperties.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(c.create());
- QVERIFY(rect != 0);
-
- QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
-
- QDeclarative1StateGroup *stateGroup = rectPrivate->_states();
- QVERIFY(stateGroup != 0);
- qmlExecuteDeferred(stateGroup);
-
- QDeclarative1State *blueState = stateGroup->findState("blue");
- QVERIFY(blueState != 0);
- qmlExecuteDeferred(blueState);
-
- QDeclarative1PropertyChanges *propertyChangesBlue = qobject_cast<QDeclarative1PropertyChanges*>(blueState->operationAt(0));
- QVERIFY(propertyChangesBlue != 0);
-
- QDeclarative1State *greenState = stateGroup->findState("green");
- QVERIFY(greenState != 0);
- qmlExecuteDeferred(greenState);
-
- QDeclarative1PropertyChanges *propertyChangesGreen = qobject_cast<QDeclarative1PropertyChanges*>(greenState->operationAt(0));
- QVERIFY(propertyChangesGreen != 0);
-
- QDeclarative1Rectangle *childRect = rect->findChild<QDeclarative1Rectangle*>("rect2");
- QVERIFY(childRect != 0);
- QCOMPARE(childRect->width(), qreal(402));
- QVERIFY(QDeclarativePropertyPrivate::binding(QDeclarativeProperty(childRect, "width")));
- QCOMPARE(childRect->height(), qreal(200));
-
- rectPrivate->setState("blue");
- QCOMPARE(childRect->width(), qreal(50));
- QCOMPARE(childRect->height(), qreal(40));
- QVERIFY(!QDeclarativePropertyPrivate::binding(QDeclarativeProperty(childRect, "width")));
- QVERIFY(blueState->bindingInRevertList(childRect, "width"));
-
-
- rectPrivate->setState("green");
- QCOMPARE(childRect->width(), qreal(200));
- QCOMPARE(childRect->height(), qreal(100));
- QVERIFY(greenState->bindingInRevertList(childRect, "width"));
-
-
- rectPrivate->setState("");
-
-
- QCOMPARE(propertyChangesBlue->actions().length(), 2);
- QVERIFY(propertyChangesBlue->containsValue("width"));
- QVERIFY(!propertyChangesBlue->containsProperty("x"));
- QCOMPARE(propertyChangesBlue->value("width").toInt(), 50);
- QVERIFY(!propertyChangesBlue->value("x").isValid());
-
- propertyChangesBlue->changeValue("width", 60);
- QCOMPARE(propertyChangesBlue->value("width").toInt(), 60);
- QCOMPARE(propertyChangesBlue->actions().length(), 2);
-
-
- propertyChangesBlue->changeExpression("width", "myRectangle.width / 2");
- QVERIFY(!propertyChangesBlue->containsValue("width"));
- QVERIFY(propertyChangesBlue->containsExpression("width"));
- QCOMPARE(propertyChangesBlue->value("width").toInt(), 0);
- QCOMPARE(propertyChangesBlue->actions().length(), 2);
-
- propertyChangesBlue->changeValue("width", 50);
- QVERIFY(propertyChangesBlue->containsValue("width"));
- QVERIFY(!propertyChangesBlue->containsExpression("width"));
- QCOMPARE(propertyChangesBlue->value("width").toInt(), 50);
- QCOMPARE(propertyChangesBlue->actions().length(), 2);
-
- QVERIFY(QDeclarativePropertyPrivate::binding(QDeclarativeProperty(childRect, "width")));
- rectPrivate->setState("blue");
- QCOMPARE(childRect->width(), qreal(50));
- QCOMPARE(childRect->height(), qreal(40));
-
- propertyChangesBlue->changeValue("width", 60);
- QCOMPARE(propertyChangesBlue->value("width").toInt(), 60);
- QCOMPARE(propertyChangesBlue->actions().length(), 2);
- QCOMPARE(childRect->width(), qreal(60));
- QVERIFY(!QDeclarativePropertyPrivate::binding(QDeclarativeProperty(childRect, "width")));
-
- propertyChangesBlue->changeExpression("width", "myRectangle.width / 2");
- QVERIFY(!propertyChangesBlue->containsValue("width"));
- QVERIFY(propertyChangesBlue->containsExpression("width"));
- QCOMPARE(propertyChangesBlue->value("width").toInt(), 0);
- QCOMPARE(propertyChangesBlue->actions().length(), 2);
- QVERIFY(QDeclarativePropertyPrivate::binding(QDeclarativeProperty(childRect, "width")));
- QCOMPARE(childRect->width(), qreal(200));
-
- propertyChangesBlue->changeValue("width", 50);
- QCOMPARE(childRect->width(), qreal(50));
-
- rectPrivate->setState("");
- QCOMPARE(childRect->width(), qreal(402));
- QVERIFY(QDeclarativePropertyPrivate::binding(QDeclarativeProperty(childRect, "width")));
-
- QCOMPARE(propertyChangesGreen->actions().length(), 2);
- rectPrivate->setState("green");
- QCOMPARE(childRect->width(), qreal(200));
- QCOMPARE(childRect->height(), qreal(100));
- QVERIFY(QDeclarativePropertyPrivate::binding(QDeclarativeProperty(childRect, "width")));
- QVERIFY(greenState->bindingInRevertList(childRect, "width"));
- QCOMPARE(propertyChangesGreen->actions().length(), 2);
-
-
- propertyChangesGreen->removeProperty("height");
- QVERIFY(!QDeclarativePropertyPrivate::binding(QDeclarativeProperty(childRect, "height")));
- QCOMPARE(childRect->height(), qreal(200));
-
- QVERIFY(greenState->bindingInRevertList(childRect, "width"));
- QVERIFY(greenState->containsPropertyInRevertList(childRect, "width"));
- propertyChangesGreen->removeProperty("width");
- QVERIFY(QDeclarativePropertyPrivate::binding(QDeclarativeProperty(childRect, "width")));
- QCOMPARE(childRect->width(), qreal(402));
- QVERIFY(!greenState->bindingInRevertList(childRect, "width"));
- QVERIFY(!greenState->containsPropertyInRevertList(childRect, "width"));
-
- propertyChangesBlue->removeProperty("width");
- QCOMPARE(childRect->width(), qreal(402));
-
- rectPrivate->setState("blue");
- QCOMPARE(childRect->width(), qreal(402));
- QCOMPARE(childRect->height(), qreal(40));
-}
-
-void tst_qdeclarativestates::QTBUG_14830()
-{
- QDeclarativeEngine engine;
-
- QDeclarativeComponent c(&engine, SRCDIR "/data/QTBUG-14830.qml");
- QDeclarative1Rectangle *rect = qobject_cast<QDeclarative1Rectangle*>(c.create());
- QVERIFY(rect != 0);
- QDeclarativeItem *item = rect->findChild<QDeclarativeItem*>("area");
-
- QCOMPARE(item->width(), qreal(171));
-}
-
-QTEST_MAIN(tst_qdeclarativestates)
-
-#include "tst_qdeclarativestates.moc"