On Mon, 29 Sep 2025 20:16:50 GMT, Alexey Ivanov <[email protected]> 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. What do others think about changing `background: #FFF` to `background: #CCC`? The white background is the default for text components. If parsing the color fails, the background color will remain white. With `#CCC`, the test will fail if the color remains white, the default color; it will also fail if `#CCC` is decoded as `0x000CCC` as was the case before [JDK-8213781](https://bugs.openjdk.org/browse/JDK-8213781) was fixed. ------------- PR Comment: https://git.openjdk.org/jdk/pull/27556#issuecomment-3348989070
