aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/data/stringArg.qml
blob: 7019af9da5fb61e3ee9b323ea04d81ae4d223c11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import QtQuick 2.0

Item {
    id: root
    property bool returnValue: false

    property string first
    property string second
    property string third
    property string fourth
    property string fifth
    property string sixth
    property string seventh
    property string eighth
    property string ninth

    function success() {
        var a = "Value is %1";
        for (var ii = 0; ii < 10; ++ii) {
            first = a.arg("string");
            second = a.arg(1);
            third = a.arg(true);
            fourth = a.arg(3.345);
            fifth = a.arg(undefined);
            sixth = a.arg(null);
            seventh = a.arg({"test":5});
            eighth = a.arg({"test":5, "again":6});
        }

        if (first != "Value is string") returnValue = false;
        if (second != "Value is 1") returnValue = false;
        if (third != "Value is true") returnValue = false;
        if (fourth != "Value is 3.345") returnValue = false;
        if (fifth != "Value is undefined") returnValue = false;
        if (sixth != "Value is null") returnValue = false;
        if (seventh != "Value is [Object object]") returnValue = false;
        if (eighth != "Value is [Object object]") returnValue = false;
        returnValue = true;
    }

    function failure() {
        returnValue = true;
        var a = "Value is %1";
        for (var ii = 0; ii < 10; ++ii) {
            ninth = a.arg(1,2,3,4);
        }
        returnValue = false;
    }
}