aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlbinding/data
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmlbinding/data')
-rw-r--r--tests/auto/qml/qqmlbinding/data/bindingOverwriting2.qml21
-rw-r--r--tests/auto/qml/qqmlbinding/data/propertiesAttachedToBindingItself.qml18
-rw-r--r--tests/auto/qml/qqmlbinding/data/restoreBinding2.qml2
-rw-r--r--tests/auto/qml/qqmlbinding/data/restoreBinding3.qml2
-rw-r--r--tests/auto/qml/qqmlbinding/data/restoreBinding4.qml2
-rw-r--r--tests/auto/qml/qqmlbinding/data/toggleEnableProperlyRemembersValues.qml13
-rw-r--r--tests/auto/qml/qqmlbinding/data/whenEvaluatedEarlyEnough.qml23
7 files changed, 78 insertions, 3 deletions
diff --git a/tests/auto/qml/qqmlbinding/data/bindingOverwriting2.qml b/tests/auto/qml/qqmlbinding/data/bindingOverwriting2.qml
new file mode 100644
index 0000000000..8d15185506
--- /dev/null
+++ b/tests/auto/qml/qqmlbinding/data/bindingOverwriting2.qml
@@ -0,0 +1,21 @@
+pragma ComponentBehavior: Bound
+import QtQuick
+
+ListView {
+ id: list
+ property int i: 0
+
+ model: 1
+ delegate: Item {
+ id: cellRootID
+ required property int index
+ Timer {
+ interval: 1
+ running: true
+ onTriggered: {
+ cellRootID.index = index + 123
+ list.i = cellRootID.index
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlbinding/data/propertiesAttachedToBindingItself.qml b/tests/auto/qml/qqmlbinding/data/propertiesAttachedToBindingItself.qml
new file mode 100644
index 0000000000..98b3aa6606
--- /dev/null
+++ b/tests/auto/qml/qqmlbinding/data/propertiesAttachedToBindingItself.qml
@@ -0,0 +1,18 @@
+import QtQml.Models
+import QtQuick
+
+Instantiator {
+ id: inst
+ model: 1
+ property int check: 0
+
+ delegate: Binding {
+ ListView.delayRemove: true
+ Component.onCompleted: inst.check += 1
+ }
+
+ Component.onCompleted: {
+ if (inst.objectAt(0))
+ inst.check += 2
+ }
+}
diff --git a/tests/auto/qml/qqmlbinding/data/restoreBinding2.qml b/tests/auto/qml/qqmlbinding/data/restoreBinding2.qml
index 8d89989613..40d4806b8c 100644
--- a/tests/auto/qml/qqmlbinding/data/restoreBinding2.qml
+++ b/tests/auto/qml/qqmlbinding/data/restoreBinding2.qml
@@ -1,5 +1,5 @@
// Copyright (C) 2019 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtQml 2.14
diff --git a/tests/auto/qml/qqmlbinding/data/restoreBinding3.qml b/tests/auto/qml/qqmlbinding/data/restoreBinding3.qml
index 9fd5fc77d0..5742a849b9 100644
--- a/tests/auto/qml/qqmlbinding/data/restoreBinding3.qml
+++ b/tests/auto/qml/qqmlbinding/data/restoreBinding3.qml
@@ -1,5 +1,5 @@
// Copyright (C) 2019 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtQml 2.14
diff --git a/tests/auto/qml/qqmlbinding/data/restoreBinding4.qml b/tests/auto/qml/qqmlbinding/data/restoreBinding4.qml
index ee183a0d10..e9d90b5e8b 100644
--- a/tests/auto/qml/qqmlbinding/data/restoreBinding4.qml
+++ b/tests/auto/qml/qqmlbinding/data/restoreBinding4.qml
@@ -1,5 +1,5 @@
// Copyright (C) 2019 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtQml 2.14
diff --git a/tests/auto/qml/qqmlbinding/data/toggleEnableProperlyRemembersValues.qml b/tests/auto/qml/qqmlbinding/data/toggleEnableProperlyRemembersValues.qml
new file mode 100644
index 0000000000..251e71f771
--- /dev/null
+++ b/tests/auto/qml/qqmlbinding/data/toggleEnableProperlyRemembersValues.qml
@@ -0,0 +1,13 @@
+import QtQml
+
+QtObject {
+ id: root
+ property bool enabled: false
+ property var func: function() { return 1 }
+ property var arr: [1, 2]
+ property Binding b: Binding {
+ root.func: function() { return 2 };
+ root.arr: [1, 2, 3]
+ when: root.enabled
+ }
+}
diff --git a/tests/auto/qml/qqmlbinding/data/whenEvaluatedEarlyEnough.qml b/tests/auto/qml/qqmlbinding/data/whenEvaluatedEarlyEnough.qml
new file mode 100644
index 0000000000..6245270e14
--- /dev/null
+++ b/tests/auto/qml/qqmlbinding/data/whenEvaluatedEarlyEnough.qml
@@ -0,0 +1,23 @@
+import QtQuick
+
+Item {
+ id: root
+ property bool toggle: true
+ property bool forceEnable: false
+
+ Item {
+ id: item1
+ property int i
+ }
+
+ Item {
+ id: item2
+ }
+
+ Binding {
+ target: root.toggle ? item1 : item2
+ when: root.forceEnable || (root.toggle ? item1 : item2).hasOwnProperty("i")
+ property: "i"
+ value: 42
+ }
+}