diff options
author | Tasuku Suzuki <stasuku@gmail.com> | 2012-11-25 04:36:33 +0900 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-11-29 17:48:46 +0100 |
commit | e0cb13a510c0099784fee00d5b4b7c608dd42dd2 (patch) | |
tree | 8d61daaaa70df2fa7b26a0c989d748fc3718e15f /tests/auto/qml/qqmlbinding/data | |
parent | 55f6a109e99ea2eb3359fa941a1826d4b4e11bf8 (diff) |
Move no-Gui related QML types from QtQuick into QtQml
Task-number: QTBUG-26340
Change-Id: I9049128db2598bf3c7a9d677b774eaae53b54eb5
Reviewed-by: Alan Alpert <aalpert@rim.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'tests/auto/qml/qqmlbinding/data')
6 files changed, 133 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlbinding/data/deletedObject.qml b/tests/auto/qml/qqmlbinding/data/deletedObject.qml new file mode 100644 index 0000000000..f9cf869ba3 --- /dev/null +++ b/tests/auto/qml/qqmlbinding/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/qqmlbinding/data/restoreBinding.qml b/tests/auto/qml/qqmlbinding/data/restoreBinding.qml new file mode 100644 index 0000000000..9491c0f1d3 --- /dev/null +++ b/tests/auto/qml/qqmlbinding/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/qqmlbinding/data/restoreBindingWithLoop.qml b/tests/auto/qml/qqmlbinding/data/restoreBindingWithLoop.qml new file mode 100644 index 0000000000..ee07104817 --- /dev/null +++ b/tests/auto/qml/qqmlbinding/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/qqmlbinding/data/restoreBindingWithoutCrash.qml b/tests/auto/qml/qqmlbinding/data/restoreBindingWithoutCrash.qml new file mode 100644 index 0000000000..0c63a16213 --- /dev/null +++ b/tests/auto/qml/qqmlbinding/data/restoreBindingWithoutCrash.qml @@ -0,0 +1,28 @@ +import QtQuick 2.0 + +Rectangle { + width: 400 + height: 400 + + states: State { + name: "state1" + PropertyChanges { + target: myItem + x: 200 - myItem.y + } + } + + 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 + } + } +} diff --git a/tests/auto/qml/qqmlbinding/data/test-binding.qml b/tests/auto/qml/qqmlbinding/data/test-binding.qml new file mode 100644 index 0000000000..87aabe975a --- /dev/null +++ b/tests/auto/qml/qqmlbinding/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/qqmlbinding/data/test-binding2.qml b/tests/auto/qml/qqmlbinding/data/test-binding2.qml new file mode 100644 index 0000000000..4a08141d11 --- /dev/null +++ b/tests/auto/qml/qqmlbinding/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 } +} |