aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlengine/data/CachedGetterLookup.qml
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2019-05-09 12:38:22 +0200
committerMichal Klocek <michal.klocek@qt.io>2019-05-09 11:13:00 +0000
commit375b8d0fbecb1acf4596b5103c12fac2b592a927 (patch)
tree5144a82b63122ac28751ff3e14c169a18af3613f /tests/auto/qml/qqmlengine/data/CachedGetterLookup.qml
parent17237efaefabe924599abe00e92d8b54032d7915 (diff)
Add test for cached getter lookup
Task-number: QTBUG-75335 Change-Id: I14480018f2429eb5ec744a50640642eee09ce3f3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlengine/data/CachedGetterLookup.qml')
-rw-r--r--tests/auto/qml/qqmlengine/data/CachedGetterLookup.qml20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlengine/data/CachedGetterLookup.qml b/tests/auto/qml/qqmlengine/data/CachedGetterLookup.qml
new file mode 100644
index 0000000000..1a2a7ff341
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/CachedGetterLookup.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.12
+
+QtObject {
+ Component.onCompleted: {
+ // create getter
+ var getFoo = function(o) { return o.foo; }
+
+ // create two diffrent shapes for x,y
+ var x = { foo:1 , bar:2 }
+ var y = { bar:2 , foo:1 }
+
+ // initialize inline cache with getFoo
+ getFoo(x);
+ getFoo(y);
+
+ // hit getter lookup with string "crash"
+ getFoo('crash');
+ }
+}
+