diff options
Diffstat (limited to 'tests/auto/qml/qquickbinding/data')
5 files changed, 105 insertions, 0 deletions
diff --git a/tests/auto/qml/qquickbinding/data/deletedObject.qml b/tests/auto/qml/qquickbinding/data/deletedObject.qml new file mode 100644 index 0000000000..f9cf869ba3 --- /dev/null +++ b/tests/auto/qml/qquickbinding/data/deletedObject.qml @@ -0,0 +1,24 @@ +import QtQuick 2.0 + +Rectangle { + id: wrapper + width: 400 + height: 400 + + property bool activateBinding: false + + Binding { + id: binding + target: Qt.createQmlObject('import QtQuick 2.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/qml/qquickbinding/data/restoreBinding.qml b/tests/auto/qml/qquickbinding/data/restoreBinding.qml new file mode 100644 index 0000000000..9491c0f1d3 --- /dev/null +++ b/tests/auto/qml/qquickbinding/data/restoreBinding.qml @@ -0,0 +1,26 @@ +import QtQuick 2.0 + +Rectangle { + width: 400 + height: 400 + + Rectangle { + id: myItem + objectName: "myItem" + width: 100 + height: 100 + color: "green" + x: 100 - myItem.y + + Binding on x { + when: myItem.y > 50 + value: myItem.y + } + + /*NumberAnimation on y { + loops: Animation.Infinite + to: 100 + duration: 1000 + }*/ + } +} diff --git a/tests/auto/qml/qquickbinding/data/restoreBindingWithLoop.qml b/tests/auto/qml/qquickbinding/data/restoreBindingWithLoop.qml new file mode 100644 index 0000000000..ee07104817 --- /dev/null +++ b/tests/auto/qml/qquickbinding/data/restoreBindingWithLoop.qml @@ -0,0 +1,23 @@ +import QtQuick 2.0 + +Rectangle { + width: 400 + height: 400 + + property bool activateBinding: false + + Rectangle { + id: myItem + objectName: "myItem" + width: 100 + height: 100 + color: "green" + x: myItem.y + 100 + onXChanged: { if (x == 188) y = 90; } //create binding loop + + Binding on x { + when: activateBinding + value: myItem.y + } + } +} diff --git a/tests/auto/qml/qquickbinding/data/test-binding.qml b/tests/auto/qml/qquickbinding/data/test-binding.qml new file mode 100644 index 0000000000..87aabe975a --- /dev/null +++ b/tests/auto/qml/qquickbinding/data/test-binding.qml @@ -0,0 +1,16 @@ +import QtQuick 2.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/qml/qquickbinding/data/test-binding2.qml b/tests/auto/qml/qquickbinding/data/test-binding2.qml new file mode 100644 index 0000000000..4a08141d11 --- /dev/null +++ b/tests/auto/qml/qquickbinding/data/test-binding2.qml @@ -0,0 +1,16 @@ +import QtQuick 2.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 } +} |