RFR: 8342098: Write a test to compare the images [v5]
Abhishek Kumar
abhiscxk at openjdk.org
Fri Oct 25 06:11:12 UTC 2024
On Tue, 22 Oct 2024 11:05:03 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 47:
> 45: * and the source image are same.
> 46: * @run main/othervm -Dsun.java2d.uiScale=1 ScreenCaptureRobotTest
> 47: */
May add a blank line after this.
test/jdk/java/awt/Robot/ScreenCaptureRobotTest.java line 91:
> 89: private static void doTest() throws Exception {
> 90: Robot robot;
> 91: robot = new Robot();
Suggestion:
Robot robot = new Robot();
test/jdk/java/awt/Robot/ScreenCaptureRobotTest.java line 122:
> 120:
> 121: imgWidth = capturedImg.getWidth(null);
> 122: imgHeight = capturedImg.getHeight(null);
Suggestion:
int imgWidth = capturedImg.getWidth(null);
int imgHeight = capturedImg.getHeight(null);
test/jdk/java/awt/Robot/ScreenCaptureRobotTest.java line 127:
> 125: || imgHeight != realImg.getHeight()) {
> 126: System.out
> 127: .println("Captured and real images are different in size");
You may like to replace `realImg.getWidth()` and `realImg.getHeight()` with IMAGE_WIDTH and IMAGE_HEIGHT since that is the width and height of `realImg`..
Suggestion:
if (imgWidth != realImg.getWidth() || imgHeight != `realImg.getHeight()`) {
System.out.println("Captured and real images are different in size");
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21524#discussion_r1816044206
PR Review Comment: https://git.openjdk.org/jdk/pull/21524#discussion_r1816044843
PR Review Comment: https://git.openjdk.org/jdk/pull/21524#discussion_r1816045748
PR Review Comment: https://git.openjdk.org/jdk/pull/21524#discussion_r1816049740
More information about the client-libs-dev
mailing list