From 12a5ddf456ba8549645a8cb28a8b4ed6197a14da Mon Sep 17 00:00:00 2001 From: Matthew Vogt Date: Mon, 30 Jan 2012 14:16:15 +1000 Subject: Import relevant source from Qt 4.8 Change-Id: I5078db4081d95290c54f39d3c0efc2fc2f62e6a6 --- .../qdeclarativebinding/data/deletedObject.qml | 24 ++++++++++++++++++++++ .../qdeclarativebinding/data/test-binding.qml | 16 +++++++++++++++ .../qdeclarativebinding/data/test-binding2.qml | 16 +++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativebinding/data/deletedObject.qml create mode 100644 tests/auto/declarative/qdeclarativebinding/data/test-binding.qml create mode 100644 tests/auto/declarative/qdeclarativebinding/data/test-binding2.qml (limited to 'tests/auto/declarative/qdeclarativebinding/data') 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 } +} -- cgit v1.2.3