RFR: 8368892: Make JEditorPane/TestBrowserBGColor.java headless

Sergey Bylokhov serb at openjdk.org
Wed Oct 1 18:44:35 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.

Marked as reviewed by serb (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/27556#pullrequestreview-3290535398


More information about the client-libs-dev mailing list