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

Andy Goryachev angorya at openjdk.org
Fri Sep 19 15:49:03 UTC 2025


On Fri, 19 Sep 2025 15:42:52 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> 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).

last time I checked, no system test needs to specify which windows to hide.

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

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


More information about the openjfx-dev mailing list