JDK-8130009 : [TEST] TextNodeTest unit test fails becase FX runtime isn't initialized
  • Type: Bug
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: 8u60,9
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-06-26
  • Updated: 2016-09-07
  • Resolved: 2015-06-26
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u60Fixed 9Fixed
Related Reports
Blocks :  
Description
I discovered this bug while testing the fix for JDK-8087793

TextNodeTest is a system test, meaning that it run with the full FX runtime, and needs to ensure that the FX runtime is initialized before constructing a scene graph. This test calls Text.setText(), which gets the system font to measure the text for bounds computations. After the fix for JDK-8087793, getting the system font needs to get the screen UI scale, which is not valid until after the FX runtime is initialized. This will not cause problems for well-formed applications, it just means that Text joins a long line of other nodes (including all controls) that fail in the same way.
Comments
http://hg.openjdk.java.net/openjfx/9-dev/rt/rev/04d092a4eb19
26-06-2015

The simple fix is to initialize the FX runtime in an @BeforeClass method as is done in other system tests. @BeforeClass public static void initFX() { final CountDownLatch startupLatch = new CountDownLatch(1); PlatformImpl.startup(() -> { startupLatch.countDown(); }); try { if (!startupLatch.await(5, TimeUnit.SECONDS)) { fail("Timeout waiting for FX runtime to start"); } } catch (InterruptedException ex) { fail("Unexpected exception: " + ex); } }
26-06-2015