summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativebinding/data
diff options
context:
space:
mode:
authorMatthew Vogt <matthew.vogt@nokia.com>2012-01-30 14:16:15 +1000
committerMatthew Vogt <matthew.vogt@nokia.com>2012-01-30 14:16:15 +1000
commit12a5ddf456ba8549645a8cb28a8b4ed6197a14da (patch)
tree63ee2c88af936e0609a3a194f5bcc304c4c0b707 /tests/auto/declarative/qdeclarativebinding/data
Import relevant source from Qt 4.8
Diffstat (limited to 'tests/auto/declarative/qdeclarativebinding/data')
-rw-r--r--tests/auto/declarative/qdeclarativebinding/data/deletedObject.qml24
-rw-r--r--tests/auto/declarative/qdeclarativebinding/data/test-binding.qml16
-rw-r--r--tests/auto/declarative/qdeclarativebinding/data/test-binding2.qml16
3 files changed, 56 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativebinding/data/deletedObject.qml b/tests/auto/declarative/qdeclarativebinding/data/deletedObject.qml
new file mode 100644
index 00000000..ba4c9f6f
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativebinding/data/deletedObject.qml
@@ -0,0 +1,24 @@
+import QtQuick 1.0
+
+Rectangle {
+ id: wrapper
+ width: 400
+ height: 400
+
+ property bool activateBinding: false
+
+ Binding {
+ id: binding
+ target: Qt.createQmlObject('import QtQuick 1.0; Item { property real value: 10 }', wrapper)
+ property: "value"
+ when: activateBinding
+ value: x + y
+ }
+
+ Component.onCompleted: binding.target.destroy();
+
+// MouseArea {
+// anchors.fill: parent
+// onClicked: activateBinding = true;
+// }
+}
diff --git a/tests/auto/declarative/qdeclarativebinding/data/test-binding.qml b/tests/auto/declarative/qdeclarativebinding/data/test-binding.qml
new file mode 100644
index 00000000..94497368
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativebinding/data/test-binding.qml
@@ -0,0 +1,16 @@
+import QtQuick 1.0
+
+Rectangle {
+ id: screen
+ width: 320; height: 240
+ property string text
+ property bool changeColor: false
+
+ Text { id: s1; text: "Hello" }
+ Rectangle { id: r1; width: 1; height: 1; color: "yellow" }
+ Rectangle { id: r2; width: 1; height: 1; color: "red" }
+
+ Binding { target: screen; property: "text"; value: s1.text; objectName: "binding1" }
+ Binding { target: screen; property: "color"; value: r1.color }
+ Binding { target: screen; property: "color"; when: screen.changeColor == true; value: r2.color; objectName: "binding3" }
+}
diff --git a/tests/auto/declarative/qdeclarativebinding/data/test-binding2.qml b/tests/auto/declarative/qdeclarativebinding/data/test-binding2.qml
new file mode 100644
index 00000000..3e99e2b5
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativebinding/data/test-binding2.qml
@@ -0,0 +1,16 @@
+import QtQuick 1.0
+
+Rectangle {
+ id: screen
+ width: 320; height: 240
+ property string text
+ property bool changeColor: false
+
+ Text { id: s1; text: "Hello" }
+ Rectangle { id: r1; width: 1; height: 1; color: "yellow" }
+ Rectangle { id: r2; width: 1; height: 1; color: "red" }
+
+ Binding { target: screen; property: "text"; value: s1.text }
+ Binding { target: screen; property: "color"; value: r1.color }
+ Binding { target: screen; property: "color"; value: r2.color; when: screen.changeColor == true }
+}