Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8248551: [TestBug] Ignore two failing FXML unit tests which use Nashorn script engine #259

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}