Skip to content

Commit

Permalink
8248551: [TestBug] Ignore two failing FXML unit tests which use Nasho…
Browse files Browse the repository at this point in the history
…rn script engine

Reviewed-by: kcr
  • Loading branch information
aghaisas committed Jun 30, 2020
1 parent 45c9854 commit 527cc2b
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();

Expand All @@ -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();

Expand All @@ -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.