RFR: 8342098: Write a test to compare the images [v7]

Alexey Ivanov aivanov at openjdk.org
Tue Nov 12 17:27:50 UTC 2024


On Thu, 31 Oct 2024 15:45:59 GMT, Naveen Narayanan <duke at openjdk.org> wrote:

>> This testcase checks for the following:
>> 
>> 1. An image is drawn on the screen and a portion of it is captured using a Robot. It is tested by comparing whether the captured image is same as the source image. 
>> 
>> Testing:
>> Tested using Mach5(20 times per platform) in MacOS, Linux and Windows. Seen all tests passing.
>
> Naveen Narayanan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8342098: Updated review comments

It looks nearly good to me.

As for test stability… I ran the test on Windows at a monitor with 200% scale, and the test passed all the time.

At the same time, the test passes on Windows in the same environment even if I remove `-Dsun.java2d.uiScale=1`.

The situation is different on Mac though. When `-Dsun.java2d.uiScale=1` is present, the test fails for me on the internal Retina display as well as on an external monitor with 2× scale (the same monitor I used for testing on Windows).

If I remove `-Dsun.java2d.uiScale=1` from the test command line, the test passes on Mac in both cases. I have no explanation to such behaviour.

test/jdk/java/awt/Robot/ScreenCaptureRobotTest.java line 103:

> 101:         EventQueue.invokeAndWait(() -> {
> 102:             point = canvas.getLocationOnScreen();
> 103:         });

Statement lambda can be replaced with expression lambda:
Suggestion:

        EventQueue.invokeAndWait(() -> point = canvas.getLocationOnScreen());

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

Changes requested by aivanov (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/21524#pullrequestreview-2430197685
PR Review Comment: https://git.openjdk.org/jdk/pull/21524#discussion_r1838464808


More information about the client-libs-dev mailing list