aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/data/function.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/data/function.qml')
-rw-r--r--tests/auto/qml/qqmlecmascript/data/function.qml23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/function.qml b/tests/auto/qml/qqmlecmascript/data/function.qml
new file mode 100644
index 0000000000..af2da7023c
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/function.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool test1: false;
+ property bool test2: false;
+ property bool test3: false;
+
+ Component.onCompleted: {
+ var a = 10;
+
+ var func1 = new Function("a", "return a + 7");
+ var func2 = new Function("a", "return Qt.atob(a)");
+ var func3 = new Function("return a");
+
+ test1 = (func1(4) == 11);
+ test2 = (func2("Hello World!") == Qt.atob("Hello World!"));
+ try {
+ func3();
+ } catch(e) {
+ test3 = true;
+ }
+ }
+}