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

Ambarish Rapte arapte at openjdk.java.net
Fri Apr 23 02:31:29 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.

This pull request has now been integrated.

Changeset: 1b407cc7
Author:    Ambarish Rapte <arapte at openjdk.org>
URL:       https://git.openjdk.java.net/jfx/commit/1b407cc7
Stats:     71 lines in 4 files changed: 48 ins; 10 del; 13 mod

8239880: CSS tests should cleanup any global state they modify

Reviewed-by: kcr

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

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


More information about the openjfx-dev mailing list