RFR: 8239880: CSS tests should cleanup any global state they modify

Kevin Rushforth kcr at openjdk.java.net
Thu Apr 22 19:47:25 UTC 2021


On Wed, 21 Apr 2021 09:01:45 GMT, Ambarish Rapte <arapte at openjdk.org> wrote:

> The tests that are modified in this PR set a stylesheet using API `StyleManager.getInstance().setDefaultUserAgentStylesheet()`.
> This is a global state and should be reset after execution of each test.
> It does not cause any test failures currently, but this has caused a test failure in past reported here [JDK-8239822](https://bugs.openjdk.java.net/browse/JDK-8239822) which was fixed with a similar change like in this PR.
> 
> A reset method like following seems sufficient to undo the changes made by `StyleManager.getInstance().setDefaultUserAgentStylesheet()`.
> But this fix uses the same method definition of `resetStyleManager()` like in the [fix](https://git.openjdk.java.net/jfx/commit/c3ee1a30) for [JDK-8239822](https://bugs.openjdk.java.net/browse/JDK-8239822)
> 
> 
> private static void resetStyleManager() {
>     StyleManager sm = StyleManager.getInstance();
>     sm.platformUserAgentStylesheetContainers.clear();
>     sm.hasDefaultUserAgentStylesheet = false;
> }
> 
> 
> Fix also has 2 cleanup changes,
> 1. A minor typo correction in code, `StyleManager.getInstance().getInstance()` is replaced with `StyleManager.getInstance()`.
> 2. In test file _HonorDeveloperSettingsTest.java_: Unused class `TestWindow` is removed and few line of commented out code(which used the TestWindow class) is removed.

Marked as reviewed by kcr (Lead).

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

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


More information about the openjfx-dev mailing list