7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation. Oracle designates this
9 * particular file as subject to the "Classpath" exception as provided
10 * by Oracle in the LICENSE file that accompanied this code.
11 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
23 * or visit www.oracle.com if you need additional information or have any
24 * questions.
25 */
26
27 import org.junit.Test;
28
29 import java.io.IOException;
30 import java.util.concurrent.atomic.AtomicBoolean;
31 import javafx.fxml.FXMLLoader;
32 import javafx.fxml.LoadListener;
33
34 import static org.junit.Assert.*;
35
36 public class FXMLLoader_ScriptTest {
37 @Test
38 @SuppressWarnings("deprecation")
39 public void testStaticScriptLoad() throws IOException {
40 FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("static_script_load.fxml"));
41 fxmlLoader.impl_setStaticLoad(true);
42 AtomicBoolean scriptCalled = new AtomicBoolean();
43 AtomicBoolean scriptEndCalled = new AtomicBoolean();
44 fxmlLoader.setLoadListener(new LoadListener() {
45
46 @Override
47 public void readImportProcessingInstruction(String target) {
48 }
49
50 @Override
51 public void readLanguageProcessingInstruction(String language) {
52 }
53
54 @Override
55 public void readComment(String comment) {
56 }
57
58 @Override
59 public void beginInstanceDeclarationElement(Class<?> type) {
60 }
61
|
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation. Oracle designates this
9 * particular file as subject to the "Classpath" exception as provided
10 * by Oracle in the LICENSE file that accompanied this code.
11 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
23 * or visit www.oracle.com if you need additional information or have any
24 * questions.
25 */
26
27 import com.sun.javafx.fxml.FXMLLoaderHelper;
28 import org.junit.Test;
29
30 import java.io.IOException;
31 import java.util.concurrent.atomic.AtomicBoolean;
32 import javafx.fxml.FXMLLoader;
33 import javafx.fxml.LoadListener;
34
35 import static org.junit.Assert.*;
36
37 public class FXMLLoader_ScriptTest {
38 @Test
39 @SuppressWarnings("deprecation")
40 public void testStaticScriptLoad() throws IOException {
41 FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("static_script_load.fxml"));
42 FXMLLoaderHelper.setStaticLoad(fxmlLoader, true);
43 AtomicBoolean scriptCalled = new AtomicBoolean();
44 AtomicBoolean scriptEndCalled = new AtomicBoolean();
45 fxmlLoader.setLoadListener(new LoadListener() {
46
47 @Override
48 public void readImportProcessingInstruction(String target) {
49 }
50
51 @Override
52 public void readLanguageProcessingInstruction(String language) {
53 }
54
55 @Override
56 public void readComment(String comment) {
57 }
58
59 @Override
60 public void beginInstanceDeclarationElement(Class<?> type) {
61 }
62
|