aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/data
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2018-03-14 14:46:00 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2018-03-17 08:01:59 +0000
commit80b5f8c2f448be574e731e5d371c38b84578f5c3 (patch)
treead30c4deb23a330acc54cb25bb9bf7ab739225ae /tests/auto/qml/qqmlecmascript/data
parentee89a8c052db0fa3dffe3e01c4c0309cf9ec80d0 (diff)
Add a test that verifies the this object in signal handlers
Ask expected, this passes currently. The this object is set to the scope object in QQmlJavaScriptExpression::evaluate, which QQmlBoundSignalExpression::evaluate calls. Task-number: QTBUG-66942 Change-Id: I16a709768f9c798910377a52b5e882bb6d554a5f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/data')
-rw-r--r--tests/auto/qml/qqmlecmascript/data/signalHandlers.qml13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/signalHandlers.qml b/tests/auto/qml/qqmlecmascript/data/signalHandlers.qml
index cd68fb9b82..14326bb9e6 100644
--- a/tests/auto/qml/qqmlecmascript/data/signalHandlers.qml
+++ b/tests/auto/qml/qqmlecmascript/data/signalHandlers.qml
@@ -102,4 +102,17 @@ QtObject {
})
return testSuccess
}
+
+ property QtObject subObject: QtObject {
+ id: subObject
+ property int value
+ property bool ok: false
+ onValueChanged: this.ok = true
+ }
+
+ function testThisInSignalHandler() {
+ subObject.ok = false
+ subObject.value = subObject.value + 1
+ return subObject.ok
+ }
}