[rfc][icedtea-web] a new reproducer LiveConnect "type conversion" tests
Jana Fabrikova
jfabriko at redhat.com
Tue Feb 12 01:34:38 PST 2013
Hello Adam, thank you for the review!
> Two small concerns:
> 1. This is adding 54 automated browser tests ... I suppose it cannot be
> avoided. However, this level of depth seems better suited for unit
> tests. Fine anyway, tests can always be blacklisted anyway.
Ok
> 2. I got:
> FAILED: AppletJSToJTypeConv_BoolTodoubleTrue_Test -
> firefox(JSToJTypeConvTest) JSToJTypeConv: the stdout should contain
> JSToJTypeConv applet initialized., but it didnt
> During test run. It is probably *not* a fault of the test but it is
> unfortunate that the test could randomly fail.
>
The above behaviour is I think present in all the reproducers that use
browser (LiveConnect). "JSToJTypeConv applet initialized." is written in
the stdout as the first thing when applet's init method runs, and if it
is not present in stdout, the applet didn't start properly, so the tests
were not performed and we do not know if they would fail or pass. It
happened to me either if I already had a window of the browser opened,
or nondeterministically when the browser/plugin decided it is a good
time to crash...
> However I believe it is OK for HEAD, just two small nits below.
>
Nits corrected, pushed into repository,
thanks again,
Jana
>> diff --git
>> a/tests/reproducers/simple/JSToJTypeConv/resources/JSToJTypeConv.html
>> b/tests/reproducers/simple/JSToJTypeConv/resources/JSToJTypeConv.html
>> new file mode 100644
>> --- /dev/null
>> +++ b/tests/reproducers/simple/JSToJTypeConv/resources/JSToJTypeConv.html
>> @@ -0,0 +1,26 @@
>> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>> +<html lang="en-US">
>> + <head>
>> + <title>JavaScript to Java LiveConnect - Types Conversion</title>
>> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
>> +
>> + <script language="JavaScript" src="JSToJava_TypeConv.js"></script>
>> +
>> + </head>
>> + <body>
>> +
>> + <h2> The JSToJTypeConv html page</h2>
>> +
>> +
>> + <applet code="JSToJTypeConv" width="1000" height="100"
>> id="jstojTypeConvApplet" MAYSCRIPT>
>> + <param name="jnlp_href" value="jstoj-typeconv.jnlp">
>> + </applet>
>> +
>> + <script type="text/javascript">
>> +
>> + doTypeConvTests();
>> +
>> + </script>
>> +
>> + </body>
>> +</html>
>> diff --git
>> a/tests/reproducers/simple/JSToJTypeConv/resources/JSToJava_TypeConv.js b/tests/reproducers/simple/JSToJTypeConv/resources/JSToJava_TypeConv.js
>>
>> new file mode 100644
>> --- /dev/null
>> +++
>> b/tests/reproducers/simple/JSToJTypeConv/resources/JSToJava_TypeConv.js
>> @@ -0,0 +1,14 @@
>> +function doTypeConvTests(){
>> +
>> + var urlArgs = document.URL.split("?");
>> + var testParams = urlArgs[1].split(";");
>> + var applet = document.getElementById('jstojTypeConvApplet');
>> +
>> + var field = testParams[0];
>> + var value = decodeURIComponent(testParams[1]);
>> +
>> + eval('applet.' + field + '=' + value);
>> + applet.printNewValueAndFinish(field);
>> +
>> +}
>> +
>> diff --git
>> a/tests/reproducers/simple/JSToJTypeConv/resources/jstoj-typeconv.jnlp
>> b/tests/reproducers/simple/JSToJTypeConv/resources/jstoj-typeconv.jnlp
>> new file mode 100644
>> --- /dev/null
>> +++
>> b/tests/reproducers/simple/JSToJTypeConv/resources/jstoj-typeconv.jnlp
>> @@ -0,0 +1,23 @@
>> +
>> +<?xml version="1.0" encoding="UTF-8"?>
>> +<jnlp spec="1.0+" codebase="" href="jstoj-typeconv.jnlp">
>> + <information>
>> + <title>JavaScript to Java LiveConnect - TypeConv</title>
>> + <vendor>IcedTea</vendor>
>> + <homepage
>> href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/>
>>
>> + <description>LiveConnect - tests for data type conversion from JS to
>> Java variables.</description>
>> + </information>
>> + <resources>
>> + <!-- Application Resources -->
>> + <j2se version="1.6+"
>> + href="http://java.sun.com/products/autodl/j2se"/>
>> + <jar href="JSToJTypeConv.jar" main="true" />
>> +
>> + </resources>
>> + <applet-desc
>> + name="JS to J TypeConv"
>> + main-class="JSToJTypeConv"
>> + width="1000"
>> + height="100">
>> + </applet-desc>
>> +</jnlp>
>> diff --git
>> a/tests/reproducers/simple/JSToJTypeConv/srcs/JSToJTypeConv.java
>> b/tests/reproducers/simple/JSToJTypeConv/srcs/JSToJTypeConv.java
>> new file mode 100644
>> --- /dev/null
>> +++ b/tests/reproducers/simple/JSToJTypeConv/srcs/JSToJTypeConv.java
>> @@ -0,0 +1,123 @@
>> +import java.applet.Applet;
>> +import java.lang.reflect.Array;
>> +import java.lang.reflect.Field;
>> +
>> +import netscape.javascript.JSObject;
>> +
>> +public class JSToJTypeConv extends Applet {
>> +
>> + public byte _byte = 0;
>> + public char _char = 'A';
>> + public short _short = 0;
>> + public int _int = 0;
>> + public long _long = 0L;
>> + public float _float = 0F;
>> + public double _double = 0.0;
>> + public boolean _boolean = false;
>> +
>> + public byte[] _byteArray = null;
>> + public char[] _charArray = null;
>> + public short[] _shortArray = null;
>> + public int[] _intArray = null;
>> + public long[] _longArray = null;
>> + public float[] _floatArray = null;
>> + public double[] _doubleArray = null;
>> + public char[][] _charArray2D = null;
>> +
>> + public Byte _Byte = null;
>> + public Character _Character = 'A';
>> + public Short _Short = 0;
>> + public Integer _Integer = 0;
>> + public Long _Long = 0L;
>> + public Float _Float = 0F;
>> + public Double _Double = 0.0;
>> + public String _String = "";
>> + public Boolean _Boolean = false;
>> + public JSObject _JSObject = null;
>> +
>> + public Byte[] _ByteArray = null;
>> + public Character[] _CharacterArray = null;
>> + public Short[] _ShortArray = null;
>> + public Integer[] _IntegerArray = null;
>> + public Long[] _LongArray = null;
>> + public Float[] _FloatArray = null;
>> + public Double[] _DoubleArray = null;
>> + public String[] _StringArray = null;
>> + public String[][] _StringArray2D = null;
>> +
>> + public Object _Object = null;
>> +
>> +
>> + public String getArrayAsStr(Object array) {
>> + if( array == null){
>> + return "null";
>> + }else{
>> + int size = Array.getLength(array);
>> +
>> + String ret = "";
>> + for (int i=0; i < size; i++) {
>> + ret += ((Array.get(array, i) == null) ? "null" : Array.get(array,
>> i).toString());
>> + ret += ",";
>> + }
>> +
>> + if (ret.length() > 0) {
>> + ret = ret.substring(0, ret.length()-1);
>> + }
>> +
>> + return "["+ret+"]";
>> + }
>> + }
>> +
>> + public void init() {
>> + String initStr = "JSToJTypeConv applet initialized.";
>> + System.out.println(initStr);
>> + }
>> +
>> + public class DummyObject {
>> + private String str;
>> +
>> + public DummyObject(String s) {
>> + this.str = s;
>> + }
>> +
>> + public void setStr(String s) {
>> + this.str = s;
>> + }
>> +
>> + public String toString() {
>> + return str;
>> + }
>> + }
>> +
>> + public DummyObject getNewDummyObject(String s){
>> + return new DummyObject(s);
>> + }
>> +
>> + public void printNewValueAndFinish(String fieldname) throws Exception {
>> + if( fieldname.equals("_Object")){
>> + System.out.println("New value is: "+_Object+" class is
>> "+_Object.getClass().getName()+" superclass is
>> "+_Object.getClass().getSuperclass().getName());
>
> Can you space this out ? And possibly split on 2 lines ?
>
>> + }else{
>> +
>> + Field field = getClass().getDeclaredField(fieldname);
>> + Object value = field.get(this);
>> +
>> + //2D arrays
>> + if( fieldname.contains("2D") ){
>> + Object row1 = Array.get(value,0);
>> + Object row2 = Array.get(value,1);
>> + Object row3 = Array.get(value,2);
>> + System.out.println( "New value is:
>> ["+getArrayAsStr(row1)+","+getArrayAsStr(row2)+","+getArrayAsStr(row3)+"]");
>>
>
> Spacing this out would be good.
>
>> +
>> + //arrays
>> + }else if (value != null && value.getClass().isArray()) {
>> + System.out.println("New value is: " + getArrayAsStr(value));
>> +
>> + //classic fields
>> + } else {
>> + System.out.println("New value is: " + value);
>> + }
>> + }
>> +
>> + System.out.println("afterTests");
>> + }
>> +}
>> diff --git
>> a/tests/reproducers/simple/JSToJTypeConv/testcases/JSToJTypeConvTest.java
>> b/tests/reproducers/simple/JSToJTypeConv/testcases/JSToJTypeConvTest.java
>> new file mode 100644
>> --- /dev/null
>> +++
>> b/tests/reproducers/simple/JSToJTypeConv/testcases/JSToJTypeConvTest.java
>> @@ -0,0 +1,469 @@
>> +/* JSToJTypeConvTest.java
>> +Copyright (C) 2012 Red Hat, Inc.
>> +
>> +This file is part of IcedTea.
>> +
>> +IcedTea is free software; you can redistribute it and/or
>> +modify it under the terms of the GNU General Public License as
>> published by
>> +the Free Software Foundation, version 2.
>> +
>> +IcedTea is distributed in the hope that it will be useful,
>> +but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>> +General Public License for more details.
>> +
>> +You should have received a copy of the GNU General Public License
>> +along with IcedTea; see the file COPYING. If not, write to
>> +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
>> Boston, MA
>> +02110-1301 USA.
>> +
>> +Linking this library statically or dynamically with other modules is
>> +making a combined work based on this library. Thus, the terms and
>> +conditions of the GNU General Public License cover the whole
>> +combination.
>> +
>> +As a special exception, the copyright holders of this library give you
>> +permission to link this library with independent modules to produce an
>> +executable, regardless of the license terms of these independent
>> +modules, and to copy and distribute the resulting executable under
>> +terms of your choice, provided that you also meet, for each linked
>> +independent module, the terms and conditions of the license of that
>> +module. An independent module is a module which is not derived from
>> +or based on this library. If you modify this library, you may extend
>> +this exception to your version of the library, but you are not
>> +obligated to do so. If you do not wish to do so, delete this
>> +exception statement from your version.
>> + */
>> +
>> +import net.sourceforge.jnlp.ProcessResult;
>> +import net.sourceforge.jnlp.ServerAccess;
>> +import net.sourceforge.jnlp.browsertesting.BrowserTest;
>> +import net.sourceforge.jnlp.browsertesting.Browsers;
>> +import net.sourceforge.jnlp.closinglisteners.CountingClosingListener;
>> +import net.sourceforge.jnlp.annotations.NeedsDisplay;
>> +import net.sourceforge.jnlp.annotations.TestInBrowsers;
>> +import org.junit.Assert;
>> +
>> +import org.junit.Test;
>> +
>> +public class JSToJTypeConvTest extends BrowserTest {
>> +
>> + private final String initStr = "JSToJTypeConv applet initialized.";
>> + private final String afterStr = "afterTests";
>> +
>> + private class CountingClosingListenerImpl extends
>> CountingClosingListener {
>> +
>> + @Override
>> + protected boolean isAlowedToFinish(String s) {
>> + return (s.contains(initStr) && s.contains(afterStr));
>> + }
>> + }
>> +
>> + private void evaluateStdoutContents(String[] expectedStdouts,
>> ProcessResult pr) {
>> + // Assert that the applet was initialized.
>> + Assert.assertTrue("JSToJTypeConv: the stdout should contain " + initStr
>> + + ", but it didnt.", pr.stdout.contains(initStr));
>> +
>> + // Assert that the values set by JavaScript are ok
>> + for(String str : expectedStdouts){
>> +
>> + String xmlStr = "new value";
>> +
>> + if(str.contains("nonXML char"))
>> + {
>> + str = str.substring(12);
>> + }else{
>> + xmlStr = str;
>> + }
>> +
>> + Assert.assertTrue("JSToJTypeConv: the output should include
>> "+xmlStr+", but it didnt.", pr.stdout.contains(str));
>> + }
>> + }
>> +
>> + private void jsToJavaTypeConvTest(String fieldStr, String valueStr,
>> String[] expectedValueAndOutputs) throws Exception {
>> + String strURL = "/JSToJTypeConv.html?" + fieldStr + ";" + valueStr;
>> + ProcessResult pr = server.executeBrowser(strURL, new
>> CountingClosingListenerImpl(), new CountingClosingListenerImpl());
>> + String[] expectedStdouts = expectedValueAndOutputs;
>> + evaluateStdoutContents(expectedStdouts, pr);
>> + }
>> +
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_NumToJavaStringInteger_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_String", "1", new String[] {"1"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_NumToJavaStringDouble_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_String", "1.1", new String[] {"1.1"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_NumToJavaObjectInteger_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_Object", "1.0", new String[] {"1","superclass
>> is java.lang.Number"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_NumToJavaObjectDouble_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_Object", "1.1", new String[]
>> {"1.1","superclass is java.lang.Number"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_NumToboolean0_Test() throws Exception {
>> + jsToJavaTypeConvTest("_boolean", "0", new String[] {"false"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_NumToboolean1dot1_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_boolean", "1.1", new String[] {"true"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_BoolToJavaBoolTrue_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_Boolean", "true", new String[] {"true"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_BoolToJavaBoolFalse_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_Boolean", "false", new String[] {"false"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_BoolToJavaObject_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_Object", "true", new String[] {"true", "class
>> is java.lang.Boolean"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_BoolToJavaString_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_String", "true", new String[] {"true"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_BoolTobyteTrue_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_byte", "true", new String[] {"1"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_BoolTocharTrue_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_char", "true", new String[] { "nonXML char
>> "+((char)1) });
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_BoolToshortTrue_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_short", "true", new String[] {"1"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_BoolTointTrue_Test() throws Exception {
>> + jsToJavaTypeConvTest("_int", "true", new String[] {"1"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_BoolTolongTrue_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_long", "true", new String[] {"1"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_BoolTofloatTrue_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_float", "true", new String[] {"1"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_BoolTodoubleTrue_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_double", "true", new String[] {"1"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_BoolTobyteFalse_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_byte", "false", new String[] {"0"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_BoolTocharFalse_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_char", "false", new String[] { "nonXML char
>> "+((char)0) });
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_BoolToshortFalse_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_short", "false", new String[] {"0"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_BoolTointFalse_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_int", "false", new String[] {"0"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_BoolTolongFalse_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_long", "false", new String[] {"0"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_BoolTofloatFalse_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_float", "false", new String[] {"0"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_BoolTodoubleFalse_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_double", "false", new String[] {"0"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_StringToObject_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_Object", "\"〒£$ǣ€\"", new String[] {"
>> 〒£$ǣ€"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_StringTobyte_Test() throws Exception {
>> + jsToJavaTypeConvTest("_byte", "\'1\'", new String[] {"1"}); //JS
>> string 'str' or "str" both ok
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_StringToshort_Test() throws Exception {
>> + jsToJavaTypeConvTest("_short", "\"1\"", new String[] {"1"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_StringToint_Test() throws Exception {
>> + jsToJavaTypeConvTest("_int", "\"1\"", new String[] {"1"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_StringTolong_Test() throws Exception {
>> + jsToJavaTypeConvTest("_long", "\"1\"", new String[] {"1"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_StringTofloat_Test() throws Exception {
>> + jsToJavaTypeConvTest("_float", "\"1.1\"", new String[] {"1.1"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_StringTodouble_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_double", "\"1.1\"", new String[] {"1.1"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_StringTochar_Test() throws Exception {
>> + jsToJavaTypeConvTest("_char", "\"1\"", new String[] { "nonXML char
>> "+((char)1) });
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_StringTobooleanEmptyFalse_Test()
>> throws Exception {
>> + jsToJavaTypeConvTest("_boolean", "\"\"", new String[] {"false"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_StringTobooleanNonemptyTrue_Test()
>> throws Exception {
>> + jsToJavaTypeConvTest("_boolean", "\"a nonempty string\"", new
>> String[] {"true"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_ArrayTobyteArr_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_byteArray", "[1,null,2]", new String[]
>> {"[1,0,2]"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_ArrayTocharArr_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_charArray", "[97,null,98]", new String[]
>> {"nonXML char [a,"+((char)0) +",b]"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_ArrayToshortArr_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_shortArray", "[1,null,2]", new String[]
>> {"[1,0,2]"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_ArrayTointArr_Test() throws Exception {
>> + jsToJavaTypeConvTest("_intArray", "[1,null,2]", new String[]
>> {"[1,0,2]"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_ArrayTolongArr_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_longArray", "[1,null,2]", new String[]
>> {"[1,0,2]"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_ArrayTofloatArr_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_floatArray", "[1,null,2]", new String[]
>> {"[1.0,0.0,2.0]"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_ArrayTodoubleArr_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_doubleArray", "[1,null,2]", new String[]
>> {"[1.0,0.0,2.0]"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_ArrayToStringArr_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_StringArray", "[1,null,2]", new String[]
>> {"[1,null,2]"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_ArrayTocharArrArr_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_charArray2D",
>> "[[\"97\",null,\"98\"],[],[\"99\",\"100\",null,\"101\"]]", new
>> String[] {"nonXML char
>> [[a,"+((char)0)+",b],[],[c,d,"+((char)0)+",e]]"}); //Error on Java
>> side: array element type mismatch
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_ArrayToStringArrArr_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_StringArray2D",
>> "[[\"00\",null,\"02\"],[],[\"20\",\"21\",null,\"23\"]]", new String[]
>> {"[[00,null,02],[],[20,21,null,23]]"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_ArrayToString_Test() throws Exception {
>> + jsToJavaTypeConvTest("_String",
>> "[[\"00\",null,\"02\"],[],[\"20\",\"21\",null,\"23\"]]", new String[]
>> {"00,,02,,20,21,,23"}); //Error on Java side: array element type mismatch
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_JSObjectToJSObject_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_JSObject", "window", new String[] {"[object
>> Window]"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_JSObjectToString_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_String", "window", new String[] {"[object
>> Window]"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_JavaObjectToJavaObject_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_Object", "new
>> applet.Packages.java.lang.Float(1.1)", new String[] {"1.1","class is
>> java.lang.Float"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_JavaObjectToString_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_String",
>> "applet.getNewDummyObject(\"dummy1\")", new String[] {"dummy1"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_nullToJavaObjectString_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_String", "null", new String[] {"null"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_StringTobooleanFalseStr_Test()
>> throws Exception {
>> + jsToJavaTypeConvTest("_boolean", "\"false\"", new String[] {"true"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_StringTobooleanTrueStr_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_boolean", "\"true\"", new String[] {"true"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_StringToBooleanFalseStr_Test()
>> throws Exception {
>> + jsToJavaTypeConvTest("_Boolean", "\"false\"", new String[] {"true"});
>> + }
>> +
>> + @Test
>> + @TestInBrowsers(testIn = { Browsers.all })
>> + @NeedsDisplay
>> + public void AppletJSToJTypeConv_StringToBooleanTrueStr_Test() throws
>> Exception {
>> + jsToJavaTypeConvTest("_Boolean", "\"true\"", new String[] {"true"});
>> + }
>> +
>> +}
>
> Please do push. Thanks!
> -Adam
More information about the distro-pkg-dev
mailing list