On Fri, 2 Jun 2023 17:56:42 GMT, Harshitha Onkar <[email protected]> wrote:
> ViewportOverlapping test was failing intermittently during CI runs on Win10
> and Win11.
>
> Although this intermittent issue wasn't replicable when the individual test
> as well as the test group was run multiple times, a defensive fix has been
> applied. The fix is made to the base class -OverlappingTestBase.java, which
> holds the common Standard Test Machinery for AWT_Mixing tests.
>
> `Toolkit.getDefaultToolkit().sync()` is added
> `OverlappingTestBase.testComponent()`. I believe Thread.sleep(500) alone,
> might not be sufficient to flush all the graphics events of this test on
> slower systems which might be causing this test to fail intermittently during
> CI runs.
>
> Screenshot capture has been added to ViewportOverlapping.java to aid
> debugging this intermittent issue, in case it should occur again.
>
> PS: Only relevant code in OverlappingTestBase has been cleaned-up as required
> by this test. There are other parts of the base class that require code
> clean-up which is best if taken up as a separate issue as it has common code
> across many AWT_Mixing tests.
test/jdk/java/awt/Mixing/AWT_Mixing/OverlappingTestBase.java line 496:
> 494:
> 495: // wait for graphic effects on systems like Win7
> 496: Toolkit.getDefaultToolkit().sync();
The recommended way now is to use `Robot.waitForIdle` which calls
`Toolkit.sync()` in a loop. This is what `Util.waitForIdle` does, I believe.
test/jdk/java/awt/Mixing/AWT_Mixing/OverlappingTestBase.java line 501:
> 499: } catch (InterruptedException e) {
> 500: e.printStackTrace();
> 501: }
You have `robot`, so you can use `robot.delay(500)` to avoid catching the
exception.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14289#discussion_r1214677014
PR Review Comment: https://git.openjdk.org/jdk/pull/14289#discussion_r1214677560