RFR: 8296554: MouseLocationOnScreenTest sometime fails when system is busy [v2]
Kevin Rushforth
kcr at openjdk.org
Tue Apr 15 15:39:57 UTC 2025
On Tue, 15 Apr 2025 15:35:44 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> 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());
>> }
>
> Good idea. As a (minor) suggestion, I might loop "5" times before calling it a failure.
> 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)?
I run this frequently on my Windows laptop with 125% and have never seen a problem. Unless we do, this seems unrelated to the bug being fixed.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1772#discussion_r2044930757
More information about the openjfx-dev
mailing list