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

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


On Fri, 19 Sep 2025 10:18:52 GMT, Jayathirth D V <jdv at openjdk.org> wrote:

>> We are seeing very rare intermittent failures in RegionBackgroundFillUITest & RegionBackgroundImageUITest tests in linux. We already have [JDK-8328217](https://bugs.openjdk.org/browse/JDK-8328217) to fix this issue.
>> 
>> To identify the root cause better, we want to capture the test content when it is failing using ScreenCaptureTestWatcher utility.
>> 
>> Since we wan to capture the test window before test stage is cleared. We are now clearing the test stage and next test setup. Initially tried updating this behaviour in `VisualTestBase` itself, but that causes tests like `test.robot.test3d.PointLightIlluminationTest` as it overrides the test setup functions.
>> 
>> This change is tested to make sure ScreenCaptureTestWatcher takes appropriate screen capture on failure and CI full headful test run is green.
>
> 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?

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

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


More information about the openjfx-dev mailing list