Debian Codegraph @

rhino/testsrc/tests/lc3/CallStatic/boolean-001.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 gTestfile = 'boolean-001.js';
7
8 /**
9 * The Java language allows static methods to be invoked using either the
10 * class name or a reference to an instance of the class, but previous
11 * versions of liveocnnect only allowed the former.
12 *
13 * author: [email protected]
14 *
15 * date: 12/9/1998
16 *
17 */
18 var SECTION = "Call static methods from an instance";
19 var VERSION = "1_4";
20 var TITLE = "LiveConnect 3.0 " +
21 SECTION;
22 startTest();
23
24 var DT = Packages.com.netscape.javascript.qa.liveconnect.DataTypeClass;
25 var dt = new DT();
26
27 var a = new Array;
28 var i = 0;
29
30 a[i++] = new TestObject(
31 "dt.staticSetBoolean( true )",
32 "dt.PUB_STATIC_BOOLEAN",
33 "dt.staticGetBoolean()",
34 "typeof dt.staticGetBoolean()",
35 true,
36 "boolean" );
37
38 a[i++] = new TestObject(
39 "dt.staticSetBoolean( false )",
40 "dt.PUB_STATIC_BOOLEAN",
41 "dt.staticGetBoolean()",
42 "typeof dt.staticGetBoolean()",
43 false,
44 "boolean" );
45
46 for ( i = 0; i < a.length; i++ ) {
47 new TestCase(
48 a[i].description +"; "+ a[i].javaFieldName,
49 a[i].jsValue,
50 a[i].javaFieldValue );
51
52 new TestCase(
53 a[i].description +"; " + a[i].javaMethodName,
54 a[i].jsValue,
55 a[i].javaMethodValue );
56
57 new TestCase(
58 a[i].javaTypeName,
59 a[i].jsType,
60 a[i].javaTypeValue );
61 }
62
63 test();
64
65 function TestObject( description, javaField, javaMethod, javaType,
66 jsValue, jsType )
67 {
68 eval (description );
69
70 this.description = description;
71 this.javaFieldName = javaField;
72 this.javaFieldValue = eval( javaField );
73 this.javaMethodName = javaMethod;
74 this.javaMethodValue = eval( javaMethod );
75 this.javaTypeName = javaType,
76 this.javaTypeValue = eval( javaType );
77
78 this.jsValue = jsValue;
79 this.jsType = jsType;
80 }