| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
gTestfile = 'array-005.js'; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
var SECTION = "LiveConnect"; |
| 18 |
var VERSION = "1_3"; |
| 19 |
var TITLE = "Java Array to JavaScript JavaArray object"; |
| 20 |
|
| 21 |
startTest(); |
| 22 |
writeHeaderToLog( SECTION + " "+ TITLE); |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
var E_TYPE = "object"; |
| 28 |
var E_CLASS = "[object JavaArray]"; |
| 29 |
|
| 30 |
var byte_array = ( new java.lang.String("hi") ).getBytes(); |
| 31 |
|
| 32 |
new TestCase( |
| 33 |
SECTION, |
| 34 |
"byte_array = new java.lang.String(\"hi\")).getBytes(); delete byte_array.length", |
| 35 |
false, |
| 36 |
delete byte_array.length ); |
| 37 |
|
| 38 |
new TestCase( |
| 39 |
SECTION, |
| 40 |
"byte_array[0]", |
| 41 |
("hi").charCodeAt(0), |
| 42 |
byte_array[0]); |
| 43 |
|
| 44 |
new TestCase( |
| 45 |
SECTION, |
| 46 |
"byte_array[1]", |
| 47 |
("hi").charCodeAt(1), |
| 48 |
byte_array[1]); |
| 49 |
|
| 50 |
byte_array.length = 0; |
| 51 |
|
| 52 |
new TestCase( |
| 53 |
SECTION, |
| 54 |
"byte_array.length = 0; byte_array.length", |
| 55 |
2, |
| 56 |
byte_array.length ); |
| 57 |
|
| 58 |
var properties = ""; |
| 59 |
for ( var p in byte_array ) { |
| 60 |
properties += ( p == "length" ) ? p : ""; |
| 61 |
} |
| 62 |
|
| 63 |
new TestCase( |
| 64 |
SECTION, |
| 65 |
"for ( var p in byte_array ) { properties += p ==\"length\" ? p : \"\" }; properties", |
| 66 |
"", |
| 67 |
properties ); |
| 68 |
|
| 69 |
new TestCase( |
| 70 |
SECTION, |
| 71 |
"byte_array[\"length\"]", |
| 72 |
2, |
| 73 |
byte_array["length"] ); |
| 74 |
|
| 75 |
byte_array["0"] = 127; |
| 76 |
|
| 77 |
new TestCase( |
| 78 |
SECTION, |
| 79 |
"byte_array[\"0\"] = 127; byte_array[0]", |
| 80 |
127, |
| 81 |
byte_array[0] ); |
| 82 |
|
| 83 |
byte_array[1] = 99; |
| 84 |
|
| 85 |
new TestCase( |
| 86 |
SECTION, |
| 87 |
"byte_array[1] = 99; byte_array[\"1\"]", |
| 88 |
99, |
| 89 |
byte_array["1"] ); |
| 90 |
|
| 91 |
test(); |
| 92 |
|