aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/data/function.qml
blob: af2da7023c7fc1786c0ecfe93f117922e27d2859 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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;
        }
    }
}