RFR: 8368892: Make JEditorPane/TestBrowserBGColor.java headless
Alexey Ivanov
aivanov at openjdk.org
Mon Sep 29 20:25:54 UTC 2025
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.
-------------
Commit messages:
- 8368892: Make JEditorPane/TestBrowserBGColor.java headless
Changes: https://git.openjdk.org/jdk/pull/27556/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27556&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8368892
Stats: 88 lines in 1 file changed: 16 ins; 31 del; 41 mod
Patch: https://git.openjdk.org/jdk/pull/27556.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/27556/head:pull/27556
PR: https://git.openjdk.org/jdk/pull/27556
More information about the client-libs-dev
mailing list