jaroslav@1239: /** jaroslav@1239: * Back 2 Browser Bytecode Translator jaroslav@1239: * Copyright (C) 2012 Jaroslav Tulach jaroslav@1239: * jaroslav@1239: * This program is free software: you can redistribute it and/or modify jaroslav@1239: * it under the terms of the GNU General Public License as published by jaroslav@1239: * the Free Software Foundation, version 2 of the License. jaroslav@1239: * jaroslav@1239: * This program is distributed in the hope that it will be useful, jaroslav@1239: * but WITHOUT ANY WARRANTY; without even the implied warranty of jaroslav@1239: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the jaroslav@1239: * GNU General Public License for more details. jaroslav@1239: * jaroslav@1239: * You should have received a copy of the GNU General Public License jaroslav@1239: * along with this program. Look for COPYING file in the top folder. jaroslav@1239: * If not, see http://opensource.org/licenses/GPL-2.0. jaroslav@1239: */ jaroslav@1239: package org.apidesign.vm4brwsr; jaroslav@1239: jaroslav@1239: import org.testng.annotations.AfterClass; jaroslav@1239: import org.testng.annotations.BeforeClass; jaroslav@1239: import org.testng.annotations.Test; jaroslav@1239: jaroslav@1239: /** Verify cooperation with net.java.html.js annotations. jaroslav@1239: * jaroslav@1239: * @author Jaroslav Tulach jaroslav@1239: */ jaroslav@1239: public class HtmlAnnotationsTest { jaroslav@1239: @Test public void fourtyTwo() throws Exception { jaroslav@1239: assertExec("Annotation used", HtmlAnnotations.class, jaroslav@1239: "fourtyTwo__I", jaroslav@1239: Double.valueOf(42) jaroslav@1239: ); jaroslav@1239: } jaroslav@1239: jaroslav@1239: @Test public void externalMul() throws Exception { jaroslav@1239: assertExec("mul function is loaded", HtmlAnnotations.class, jaroslav@1239: "useExternalMul__III", jaroslav@1239: Double.valueOf(42), jaroslav@1239: 7, 6 jaroslav@1239: ); jaroslav@1239: } jaroslav@1240: /* jaroslav@1240: @Test public void callRunnableFromJS() throws Exception { jaroslav@1240: assertExec("runnable called", HtmlAnnotations.class, jaroslav@1240: "callback__I", jaroslav@1240: Double.valueOf(1) jaroslav@1240: ); jaroslav@1240: } jaroslav@1240: */ jaroslav@1239: jaroslav@1239: private static TestVM code; jaroslav@1239: jaroslav@1239: @BeforeClass jaroslav@1239: public void compileTheCode() throws Exception { jaroslav@1239: code = TestVM.compileClass("org/apidesign/vm4brwsr/HtmlAnnotations"); jaroslav@1239: } jaroslav@1239: @AfterClass jaroslav@1239: public static void releaseTheCode() { jaroslav@1239: code = null; jaroslav@1239: } jaroslav@1239: private static void assertExec(String msg, Class clazz, String method, Object expRes, Object... args) throws Exception { jaroslav@1239: code.assertExec(msg, clazz, method, expRes, args); jaroslav@1239: } jaroslav@1239: jaroslav@1239: }