1.1 --- a/json-tck/src/main/java/net/java/html/js/tests/Bodies.java Wed Dec 04 23:51:13 2013 +0100
1.2 +++ b/json-tck/src/main/java/net/java/html/js/tests/Bodies.java Fri Dec 06 16:31:36 2013 +0100
1.3 @@ -46,4 +46,9 @@
1.4
1.5 @JavaScriptBody(args = "o", body = "return o.x;")
1.6 public static native int readX(Object o);
1.7 +
1.8 + @JavaScriptBody(args = { "c" }, javacall = true, body =
1.9 + "return c.@net.java.html.js.tests.Sum::sum(II)(40, 2);"
1.10 + )
1.11 + public static native int sumIndirect(Sum c);
1.12 }
2.1 --- a/json-tck/src/main/java/net/java/html/js/tests/JavaScriptBodyTest.java Wed Dec 04 23:51:13 2013 +0100
2.2 +++ b/json-tck/src/main/java/net/java/html/js/tests/JavaScriptBodyTest.java Fri Dec 06 16:31:36 2013 +0100
2.3 @@ -62,6 +62,11 @@
2.4 Object b = Bodies.callback(c);
2.5 assert b == Boolean.TRUE : "Should return true";
2.6 }
2.7 +
2.8 + @KOTest public void callbackWithParameters() {
2.9 + int res = Bodies.sumIndirect(new Sum());
2.10 + assert res == 42 : "Expecting 42";
2.11 + }
2.12
2.13 private static class R implements Runnable {
2.14 int cnt;
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/json-tck/src/main/java/net/java/html/js/tests/Sum.java Fri Dec 06 16:31:36 2013 +0100
3.3 @@ -0,0 +1,32 @@
3.4 +/**
3.5 + * HTML via Java(tm) Language Bindings
3.6 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
3.7 + *
3.8 + * This program is free software: you can redistribute it and/or modify
3.9 + * it under the terms of the GNU General Public License as published by
3.10 + * the Free Software Foundation, version 2 of the License.
3.11 + *
3.12 + * This program is distributed in the hope that it will be useful,
3.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.15 + * GNU General Public License for more details. apidesign.org
3.16 + * designates this particular file as subject to the
3.17 + * "Classpath" exception as provided by apidesign.org
3.18 + * in the License file that accompanied this code.
3.19 + *
3.20 + * You should have received a copy of the GNU General Public License
3.21 + * along with this program. Look for COPYING file in the top folder.
3.22 + * If not, see http://wiki.apidesign.org/wiki/GPLwithClassPathException
3.23 + */
3.24 +
3.25 +package net.java.html.js.tests;
3.26 +
3.27 +/**
3.28 + *
3.29 + * @author Jaroslav Tulach <jtulach@netbeans.org>
3.30 + */
3.31 +public final class Sum {
3.32 + public int sum(int a, int b) {
3.33 + return a + b;
3.34 + }
3.35 +}