Integrated: 8368892: Make JEditorPane/TestBrowserBGColor.java headless
Alexey Ivanov
aivanov at openjdk.org
Tue Oct 7 10:25:00 UTC 2025
On Mon, 29 Sep 2025 20:16:50 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
> This is to update `javax/swing/JEditorPane/TestBrowserBGColor.java` and to let it run headless.
>
> Currently, the test creates a frame with `JEditorPane` with an HTML document the background color of which is set with three hex digits, `background: #FFF`. Then the test uses `Robot.getPixelColor` to verify the color of the pixel on the screen.
>
> Now, the editor pane is rendered into a buffered image, this is needed to ensure text is laid out. The test then searches for a view that represents the `<body>` element and verifies that its background color is set to the expected *white* color. If it isn't so, the test saves the image for reference and throws an exception to indicate failure.
>
> The updated test fails with JDK 11 because [JDK-8213781](https://bugs.openjdk.org/browse/JDK-8213781) isn't backported yet; the test passes with later versions including mainline. I ran the updated test on the CI, and it passes.
This pull request has now been integrated.
Changeset: 6bec42ad
Author: Alexey Ivanov <aivanov at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/6bec42adcc1d99e16ddd5148bb4012c74a0c3090
Stats: 88 lines in 1 file changed: 16 ins; 31 del; 41 mod
8368892: Make JEditorPane/TestBrowserBGColor.java headless
Reviewed-by: serb, azvegint
-------------
PR: https://git.openjdk.org/jdk/pull/27556
More information about the client-libs-dev
mailing list