RFR: 8239822: Intermittent unit test failures in RegionCSSTest

Dean Wookey dwookey at openjdk.java.net
Sat Feb 22 20:25:49 UTC 2020

On Sat, 22 Feb 2020 15:54:16 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> 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.
> @aghaisas Can you review this?
> @DeanWookey You are also welcome to review it if you like.

test.javafx.css.Node_cssStateTransition_Test may also need the same treatment.


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

More information about the openjfx-dev mailing list