RFR: 8239822: Intermittent unit test failures in RegionCSSTest

Kevin Rushforth kcr at openjdk.java.net
Sat Feb 22 15:56:11 UTC 2020


This is a fix for an intermittent test failure affecting `test.javafx.scene.layout.RegionCSSTest`. This turns out to be a test bug in `test.javafx.scene.CssStyleHelperTest`, which was added as part of [JDK-8237469](https://bugs.openjdk.java.net/browse/JDK-8237469). RegionCSSTest is a victim of this bug.

Except for the systemTests project, all unit tests are run in the same JVM, so each test class must ensure that any modified global state is restored after the tests are run. The CssStyleHelperTest leaves a userAgentStyleSheet set, which is a global (per Application) attribute, so any subsequent tests will be run with that stylesheet set. If the last test that is run in CssStyleHelperTest sets a style sheet with `"-fx-background"` then it will cause assertion failures in 78 of the tests in RegionCSSTest. 

The fix is to cleanup the global userAgentStyleSheet, along with any other state that is set, in an  `@AfterClass` cleanup method.

-------------

Commits:
 - d6dcd6bf: 8239822: Intermittent unit test failures in RegionCSSTest

Changes: https://git.openjdk.java.net/jfx/pull/124/files
 Webrev: https://webrevs.openjdk.java.net/jfx/124/webrev.00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8239822
  Stats: 18 lines in 1 file changed: 12 ins; 3 del; 3 mod
  Patch: https://git.openjdk.java.net/jfx/pull/124.diff
  Fetch: git fetch https://git.openjdk.java.net/jfx pull/124/head:pull/124

PR: https://git.openjdk.java.net/jfx/pull/124


More information about the openjfx-dev mailing list