| 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 = 'null-002.js'; |
| 7 | |
| 8 | /** |
| 9 | * Preferred Argument Conversion. |
| 10 | * |
| 11 | * There is no preference among Java types for converting from the jJavaScript |
| 12 | * undefined value. |
| 13 | * |
| 14 | */ |
| 15 | var SECTION = "Preferred argument conversion: null"; |
| 16 | var VERSION = "1_4"; |
| 17 | var TITLE = "LiveConnect 3.0 JavaScript to Java Data Type Conversion " + |
| 18 | SECTION; |
| 19 | startTest(); |
| 20 | |
| 21 | // pass null to a static method that expects an Object with explicit |
| 22 | // method syntax. |
| 23 | |
| 24 | new TestCase( |
| 25 | "java.lang.String[\"valueOf(java.lang.Object)\"](null) +''", |
| 26 | "null", |
| 27 | java.lang.String["valueOf(java.lang.Object)"](null) + "" ); |
| 28 | |
| 29 | // Pass null to a static method that expects a string without explicit |
| 30 | // method syntax. In this case, there is only one matching method. |
| 31 | |
| 32 | new TestCase( |
| 33 | "java.lang.Boolean.valueOf(null) +''", |
| 34 | "false", |
| 35 | java.lang.Boolean.valueOf(null) +"" ); |
| 36 | |
| 37 | // Pass null to a static method that expects a string using explicit |
| 38 | // method syntax. |
| 39 | |
| 40 | new TestCase( |
| 41 | "java.lang.Boolean[\"valueOf(java.lang.String)\"](null)", |
| 42 | "false", |
| 43 | java.lang.Boolean["valueOf(java.lang.String)"](null) +"" ); |
| 44 | |
| 45 | test(); |