aboutsummaryrefslogtreecommitdiffstats
path: root/plugin/tests/LiveConnect/jjs_get_tests.js
blob: 05c2c8f56bde44b9ecb12c4ea4a45c28958380da (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*****************************************
 * Tests for reading JS values from Java *
 *****************************************/

function jjsGetMemberTests() {

    initVars();

    document.getElementById("results").innerHTML +=  "<h2>JS -> Java get tests:</h2>";

    var tbl = document.createElement("table");
    var tblBody = document.createElement("tbody");
    var columnNames = new Array();
    columnNames[0] = "Member Type";
    columnNames[1] = "Expected Value";
    columnNames[2] = "Actual value";
    columnNames[3] = "Status";
    var row;

    createResultTable(tbl, tblBody, columnNames);

    try {
        row = document.createElement("tr");
        type = "int";
        expectedvalue = intvar;
        tpassed = PluginTest.jjsReadIntTest();
        actualValue = PluginTest.value;
        addResult(type, expectedvalue, PluginTest.value, row);
        check(tpassed, true, "boolean", row);
    } catch (e) {
        error(type, "", e, row);
    }
    tblBody.appendChild(row);
    
    try {
        row = document.createElement("tr");
        type = "double";
        expectedvalue = doublevar;
        tpassed = PluginTest.jjsReadDoubleTest();
        actualValue = PluginTest.value;
        addResult(type, expectedvalue, PluginTest.value, row);
        check(tpassed, true, "boolean", row);
    } catch (e) {
        error(type, "", e, row);
    }
    tblBody.appendChild(row);
    
    try {
        row = document.createElement("tr");
        type = "boolean";
        expectedvalue = boolvar;
        tpassed = PluginTest.jjsReadBooleanTest();
        actualValue = PluginTest.value;
        addResult(type, expectedvalue, PluginTest.value, row);
        check(tpassed, true, "boolean", row);
    } catch (e) {
        error(type, "", e, row);
    }
    tblBody.appendChild(row);

    try {
        row = document.createElement("tr");
        type = "string";
        expectedvalue = stringvar;
        tpassed = PluginTest.jjsReadStringTest();
        actualValue = PluginTest.value;
        addResult(type, expectedvalue, PluginTest.value, row);
        check(tpassed, true, "boolean", row);
    } catch (e) {
        error(type, "", e, row);
    }
    tblBody.appendChild(row);
    
    try {
        row = document.createElement("tr");
        type = "object";
        expectedvalue = objectvar;
        tpassed = PluginTest.jjsReadObjectTest();
        actualValue = PluginTest.value;
        addResult(type, expectedvalue, PluginTest.value, row);
        check(tpassed, true, "boolean", row);
    } catch (e) {
        error(type, "", e, row);
    }
    tblBody.appendChild(row);
    
    try {
        row = document.createElement("tr");
        type = "1D Array";
        expectedvalue = 100;
        tpassed = PluginTest.jjsRead1DArrayTest();
        actualValue = PluginTest.value;
        addResult(type, expectedvalue, PluginTest.value, row);
        check(tpassed, true, "boolean", row);
    } catch (e) {
        error(type, "", e, row);
    }
    tblBody.appendChild(row);

    try {
        row = document.createElement("tr");
        type = "2D Array";
        expectedvalue = 200;
        tpassed = PluginTest.jjsRead2DArrayTest();
        actualValue = PluginTest.value;
        addResult(type, expectedvalue, PluginTest.value, row);
        check(tpassed, true, "boolean", row);
    } catch (e) {
        error(type, "", e, row);
    }
    tblBody.appendChild(row); return;

}