| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
package com.netscape.javascript.qa.liveconnect.jsobject; |
| 6 |
|
| 7 |
import netscape.javascript.*; |
| 8 |
|
| 9 |
import com.netscape.javascript.qa.liveconnect.LiveConnectTest; |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
public class JSObject_001 extends LiveConnectTest { |
| 23 |
public JSObject_001() { |
| 24 |
super(); |
| 25 |
} |
| 26 |
|
| 27 |
public static void main( String[] args ) { |
| 28 |
JSObject_001 test = new JSObject_001(); |
| 29 |
test.start(); |
| 30 |
} |
| 31 |
|
| 32 |
public void executeTest() { |
| 33 |
getDouble( "NaN" ); |
| 34 |
getDouble( "Infinity" ); |
| 35 |
getJSObject( "parseInt" ); |
| 36 |
getJSObject( "parseFloat" ); |
| 37 |
getJSObject( "eval" ); |
| 38 |
getJSObject( "escape" ); |
| 39 |
getJSObject( "unescape" ); |
| 40 |
getJSObject( "isNaN" ); |
| 41 |
getJSObject( "isFinite" ); |
| 42 |
getJSObject( "Object" ); |
| 43 |
getJSObject( "Function" ); |
| 44 |
getJSObject( "Array" ); |
| 45 |
getJSObject( "String" ); |
| 46 |
getJSObject( "Boolean" ); |
| 47 |
getJSObject( "Number" ); |
| 48 |
getJSObject( "Date" ); |
| 49 |
getJSObject( "Math" ); |
| 50 |
} |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
public void getDouble( String property ) { |
| 60 |
Object jsobject = null; |
| 61 |
String exception = null; |
| 62 |
|
| 63 |
String identifier = this.getClass().toString(); |
| 64 |
String description = "Object jsobject = global.getMember(\""+ |
| 65 |
property +"\"); jsobject instanceof java.lang.Double "; |
| 66 |
|
| 67 |
try { |
| 68 |
jsobject = global.getMember( property ); |
| 69 |
} catch ( Exception e ) { |
| 70 |
exception = ("Exception getting " + property +": "+ e.toString()); |
| 71 |
System.err.println( exception ); |
| 72 |
} |
| 73 |
|
| 74 |
String expect = "true"; |
| 75 |
String actual = (jsobject instanceof java.lang.Double) +""; |
| 76 |
|
| 77 |
addTestCase( description, expect, actual, exception ); |
| 78 |
} |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
public void getJSObject( String property ) { |
| 88 |
Object jsobject = null; |
| 89 |
String exception = null; |
| 90 |
|
| 91 |
String identifier = this.getClass().toString(); |
| 92 |
String description = "Object jsobject = global.getMember(\""+ |
| 93 |
property +"\"); jsobject instanceof JSObject "; |
| 94 |
|
| 95 |
try { |
| 96 |
jsobject = global.getMember( property ); |
| 97 |
} catch ( Exception e ) { |
| 98 |
exception = ("Exception getting " + property +": "+ e.toString()); |
| 99 |
System.err.println( exception ); |
| 100 |
} |
| 101 |
|
| 102 |
String expect = "true"; |
| 103 |
String actual = (jsobject instanceof JSObject) +""; |
| 104 |
|
| 105 |
addTestCase( description, expect, actual, exception ); |
| 106 |
} |
| 107 |
} |