RFR: 8367991: Update RegionBackground tests to use ScreenCaptureTestWatcher utility [v2]

Kevin Rushforth kcr at openjdk.org
Fri Sep 19 15:46:13 UTC 2025


On Fri, 19 Sep 2025 15:12:39 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> Jayathirth D V has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add missing initialization logic
>
> tests/system/src/test/java/test/robot/javafx/scene/layout/RegionBackgroundImageUITest.java line 57:
> 
>> 55:     @BeforeEach
>> 56:     public void doSetup() {
>> 57:         runAndWait(() -> {
> 
> suggestion:
> 
> we've got `Util::shutdown()` which `hide()`s all the windows then calls `Platform::exit`.
> 
> we could add `Util::hideAllWindows(Runnable)` that can be used in these tests, and remove stages from the `VisualTestBase class`:
> 
> 
>     /**
>      * This synchronous method first hides all the open {@code Window}s in the platform thread,
>      * then invokes {@link Platform.exit()}.
>      */
>     public static void shutdown() {
>         hideAllWindows(Platform::exit);
>     }
> 
>     /// Hides all open `Window`s then invokes `after` (if non-null) in the FX Application Thread.
>     public static void hideAllWindows(Runnable after) {
>         runAndWait(() -> {
>             List.
>                 copyOf(Window.getWindows()).
>                 forEach(Window::hide);
>             if (after != null) {
>                 after.run();
>             }
>         });
>     }
> 
> 
> What do you think?

Seems like a good idea, but I'd recommend doing it as a separate follow-on bug.

Btw, I would add a `Window... windows` parameter and then this would also be useful for test that only want to close a subset of their windows (some such tests have the main stage remain showing throughout the test and don't want that window closed).

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1913#discussion_r2363358018


More information about the openjfx-dev mailing list