On Mon, 14 Apr 2025 16:48:51 GMT, Andy Goryachev <ango...@openjdk.org> wrote:
>> Gopal Pattnaik has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Addressed Review comments > > tests/system/src/test/java/test/robot/javafx/scene/MouseLocationOnScreenTest.java > line 123: > >> 121: try { >> 122: Util.sleep(DELAY_TIME); >> 123: Assertions.assertEquals(x, (int) robot.getMouseX()); > > this works also, though I'd simply use `if`. > > A bigger question is why are we using `int` coordinates? Wouldn't it make > the test depend on the scale (and also on the screen resolution and window > position)? > > Should we instead use the double coordinates and `Assertions.equals(double, > double, double)` ? I would recommend to use a for loop as below. private static int VALIDATE_COUNT = 3; static void validate(Robot robot, int x, int y) { for (int i = 0; i < VALIDATE_COUNT; i++) { Util.sleep(DELAY_TIME); if (x == (int)robot.getMouseX() && y == (int)robot.getMouseY()) { break; } } Assertions.assertEquals(x, (int) robot.getMouseX()); Assertions.assertEquals(y, (int) robot.getMouseY()); } ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/1772#discussion_r2043826793