Skip to content
Permalink
Browse files

8248551: [TestBug] Ignore two failing FXML unit tests which use Nasho…

…rn script engine

Reviewed-by: kcr
  • Loading branch information
aghaisas committed Jun 30, 2020
1 parent 45c9854 commit 527cc2b074efb83f8a4031e754626e1d6dafac4d
Showing with 19 additions and 1 deletion.
  1. +19 −1 modules/javafx.fxml/src/test/java/test/javafx/fxml/FXMLLoader_ScriptTest.java
@@ -1,6 +1,6 @@
package test.javafx.fxml;
/*
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,8 +31,11 @@
import java.util.concurrent.atomic.AtomicBoolean;
import javafx.fxml.FXMLLoader;
import javafx.fxml.LoadListener;
import javax.script.ScriptEngineManager;
import javax.script.ScriptEngine;

import static org.junit.Assert.*;
import static org.junit.Assume.assumeTrue;

public class FXMLLoader_ScriptTest {
@Test
@@ -130,6 +133,10 @@ public void endElement(Object value) {
@Test
public void testScriptHandler() throws IOException {

// This test needs Nashorn script engine.
// Test will be rewritten under - JDK-8245568
assumeTrue(isNashornEngineAvailable());

FXMLLoader loader = new FXMLLoader(getClass().getResource("script_handler.fxml"));
loader.load();

@@ -143,6 +150,10 @@ public void testScriptHandler() throws IOException {
@Test
public void testExternalScriptHandler() throws IOException {

// This test needs Nashorn script engine.
// Test will be rewritten under - JDK-8245568
assumeTrue(isNashornEngineAvailable());

FXMLLoader loader = new FXMLLoader(getClass().getResource("script_handler_external.fxml"));
loader.load();

@@ -152,4 +163,11 @@ public void testExternalScriptHandler() throws IOException {
w.fire();
assertTrue(((AtomicBoolean)loader.getNamespace().get("actionDone")).get());
}

private boolean isNashornEngineAvailable() {
ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName("nashorn");

return (engine != null);
}
}

0 comments on commit 527cc2b

Please sign in to comment.
You can’t perform that action at this time.