summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeecmascript/data
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-04-29 22:19:00 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-04-29 22:21:42 (GMT)
commit204cf6be3d63b16981843b0ae6a544e30da35134 (patch)
treea9e425c956ea9e8e6793fd752179983cd48e3eda /tests/auto/declarative/qdeclarativeecmascript/data
parente1c3dc3dad4604c8b0d2f70ef4602c5bead71ade (diff)
downloadQt-204cf6be3d63b16981843b0ae6a544e30da35134.zip
Qt-204cf6be3d63b16981843b0ae6a544e30da35134.tar.gz
Qt-204cf6be3d63b16981843b0ae6a544e30da35134.tar.bz2
Warn on assigning a function to a QML property.
This is not supported, and should not silently be converting the function to a string. See QTBUG-10302 for why we check !isRegExp as well as isFunction. Task-number: QTBUG-10237 Reviewed-by: Aaron Kennedy
Diffstat (limited to 'tests/auto/declarative/qdeclarativeecmascript/data')
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.1.qml5
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.2.qml13
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.1.qml
new file mode 100644
index 0000000..09540f1
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.1.qml
@@ -0,0 +1,5 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property variant a: function myFunction() { return 2; }
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.2.qml
new file mode 100644
index 0000000..948b39c
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.2.qml
@@ -0,0 +1,13 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property variant a
+ property bool runTest: false
+ onRunTestChanged: {
+ function myFunction() {
+ console.log("hello world");
+ }
+ a = myFunction;
+ }
+
+}