8292588: [macos] Multiscreen/MultiScreenLocationTest/MultiScreenLocationTest.java: Robot.mouseMove test failed on Screen #0

Reviewed-by: dnguyen, jdv
This commit is contained in:
Alisen Chung 2023-02-07 20:28:52 +00:00
parent 53f72edcf6
commit 2a579ab839
2 changed files with 15 additions and 0 deletions

View File

@ -70,9 +70,12 @@ public class MultiScreenLocationTest {
GraphicsConfiguration gc = gd.getDefaultConfiguration(); GraphicsConfiguration gc = gd.getDefaultConfiguration();
Rectangle screen = gc.getBounds(); Rectangle screen = gc.getBounds();
Robot robot = new Robot(gd); Robot robot = new Robot(gd);
robot.setAutoDelay(250);
robot.waitForIdle();
// check Robot.mouseMove() // check Robot.mouseMove()
robot.mouseMove(screen.x + mouseOffset.x, screen.y + mouseOffset.y); robot.mouseMove(screen.x + mouseOffset.x, screen.y + mouseOffset.y);
robot.waitForIdle();
Point mouse = MouseInfo.getPointerInfo().getLocation(); Point mouse = MouseInfo.getPointerInfo().getLocation();
Point point = screen.getLocation(); Point point = screen.getLocation();
point.translate(mouseOffset.x, mouseOffset.y); point.translate(mouseOffset.x, mouseOffset.y);
@ -100,6 +103,16 @@ public class MultiScreenLocationTest {
|| image.getRGB(image.getWidth() - 1, 0) != rgb || image.getRGB(image.getWidth() - 1, 0) != rgb
|| image.getRGB(image.getWidth() - 1, image.getHeight() - 1) != rgb || image.getRGB(image.getWidth() - 1, image.getHeight() - 1) != rgb
|| image.getRGB(0, image.getHeight() - 1) != rgb) { || image.getRGB(0, image.getHeight() - 1) != rgb) {
System.out.println("Robot.createScreenCapture Expected: " +
String.format("0x%08X",rgb));
System.out.println("Robot.createScreenCapture Top Left Actual: " +
String.format("0x%08X",image.getRGB(0, 0)));
System.out.println("Robot.createScreenCapture Top Right Actual: " +
String.format("0x%08X",image.getRGB(image.getWidth() - 1, 0)));
System.out.println("Robot.createScreenCapture Bottom Right Actual: " +
String.format("0x%08X",image.getRGB(image.getWidth() - 1, image.getHeight() - 1)));
System.out.println("Robot.createScreenCapture Top Left Actual: " +
String.format("0x%08X",image.getRGB(0, image.getHeight() - 1)));
throw new RuntimeException( throw new RuntimeException(
getErrorText("Robot.createScreenCapture", i)); getErrorText("Robot.createScreenCapture", i));
} }

View File

@ -174,6 +174,8 @@ public final class Util {
if (screen.equals(color)) { if (screen.equals(color)) {
return true; return true;
} }
System.out.println("Robot.getPixelColor Expected: " + color);
System.out.println("Robot.getPixelColor Actual: " + screen);
} }
return false; return false;
} }