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

Abhishek Kumar abhiscxk at openjdk.org
Tue Oct 22 04:47:25 UTC 2024


On Mon, 21 Oct 2024 16:56:17 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

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

> 73:         g.setColor(Color.YELLOW);
> 74:         g.fillRect(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT);
> 75:         g.setColor(Color.red);

For consistency.
Suggestion:

        g.setColor(Color.RED);

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

> 91:         robot = new Robot();
> 92:         robot.delay(500);
> 93:         robot.waitForIdle();

Order needs to be changed.

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

> 125:                 || imgHeight != realImg.getHeight()) {
> 126:             System.out.println(
> 127:                     "Captured image and real image widths are different");

Check is for width and height both, so let's have a generic message
Suggestion:

                    "Captured image and real image are different in size");

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

> 130: 
> 131:         for (int i = 0; i < (imgWidth); i++) {
> 132:             for (int j = 0; j < (imgHeight); j++) {

Suggestion:

        for (int i = 0; i < imgWidth; i++) {
            for (int j = 0; j < imgHeight; j++) {

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21524#discussion_r1809914952
PR Review Comment: https://git.openjdk.org/jdk/pull/21524#discussion_r1809865407
PR Review Comment: https://git.openjdk.org/jdk/pull/21524#discussion_r1809925107
PR Review Comment: https://git.openjdk.org/jdk/pull/21524#discussion_r1809927512


More information about the client-libs-dev mailing list