RFR: 8348865: JButton/bug4796987.java never runs because Windows XP is unavailable

Alexey Ivanov aivanov at openjdk.org
Tue Jan 28 15:01:20 UTC 2025


On Tue, 28 Jan 2025 14:51:57 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

> The `javax/swing/JButton/4796987/bug4796987.java` test strictly verifies if it's run on Windows XP, for this reason it never runs on modern versions of Windows.
> 
> Since Windows XP is obsolete and visual styles cannot be disabled since Windows 8, I removed the OS version check completely.
> 
> I captured an image of the panel and analyse colors in the image instead of using `Robot.getPixelColor`; I save the image for reference if the test fails.
> 
> The updated test passes in the CI.

test/jdk/javax/swing/JButton/4796987/bug4796987.java line 79:

> 77: 
> 78:         // Hover over button1
> 79:         Point b1Center = Util.getCenterPoint(button1);

This is a center point of `button1` in screen coordinates.

test/jdk/javax/swing/JButton/4796987/bug4796987.java line 88:

> 86:         BufferedImage image = robot.createScreenCapture(panelBounds);
> 87: 
> 88:         final Point p1 = Util.invokeOnEDT(() -> getCenterPoint(button1));

Here, `p1` is the center point of `button1` relative to its parent, `panel`. It can be used to iterate over the pixels in the captured image. Previously, it was in screen coordinates for `Robot.getPixelColor`.)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23336#discussion_r1932324647
PR Review Comment: https://git.openjdk.org/jdk/pull/23336#discussion_r1932328800


More information about the client-libs-dev mailing list