RFR: 8255079: RobotTest::testPixelCaptureAverage fails intermittently on Windows with HiDPI scaling

Lukasz Kostyra lkostyra at openjdk.org
Fri Sep 15 15:27:56 UTC 2023


The instability came from the way Windows sets window's default position. When it is not predefined on Stage creation (which was the case in these Robot tests) the window is created at some arbitrary position chosen by Windows near top-left corner. It also seems like Windows first picks the position assuming 100% scaling and then multiplies it by UI scale, which can provide X/Y coordinates of Stage with a fractional value.

Due to above behavior, there is a chance that the fractional part of X/Y will be above .5 which fails the test (X/Y values were fetched via casting directly to `int`, which drops the fractional part without rounding). Adding rounding makes the test always pass and the assumption in the comment below consistent.

`unstable.test` property check was removed, since this change stabilizes the test and its results.

Verified also on macOS to ensure the change did not affect the tests.

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

Commit messages:
 - Round stage X/Y coordinates in testPixelCaptureAverage

Changes: https://git.openjdk.org/jfx/pull/1242/files
 Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1242&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8255079
  Stats: 7 lines in 1 file changed: 0 ins; 4 del; 3 mod
  Patch: https://git.openjdk.org/jfx/pull/1242.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/1242/head:pull/1242

PR: https://git.openjdk.org/jfx/pull/1242


More information about the openjfx-dev mailing list