Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8298496: IconifyTest fails intermittently on Linux
Reviewed-by: arapte
  • Loading branch information
kevinrushforth committed Dec 15, 2022
1 parent 58376eb commit 30147d2
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions tests/system/src/test/java/test/robot/javafx/stage/IconifyTest.java
Expand Up @@ -57,19 +57,25 @@ public class IconifyTest extends VisualTestBase {
private Stage topStage;

public void canIconifyStage(StageStyle stageStyle, boolean resizable) throws Exception {
final CountDownLatch shownLatch = new CountDownLatch(2);
final CountDownLatch bottomShownLatch = new CountDownLatch(1);
final CountDownLatch topShownLatch = new CountDownLatch(1);

runAndWait(() -> {
// Bottom stage, should be visible after top stage is iconified
bottomStage = getStage(true);
bottomStage = getStage(false);
Scene bottomScene = new Scene(new Pane(), WIDTH, HEIGHT);
bottomScene.setFill(BOTTOM_COLOR);
bottomStage.setScene(bottomScene);
bottomStage.setX(0);
bottomStage.setY(0);
bottomStage.setOnShown(e -> Platform.runLater(shownLatch::countDown));
bottomStage.setOnShown(e -> Platform.runLater(bottomShownLatch::countDown));
bottomStage.show();
});

assertTrue("Timeout waiting for bottom stage to be shown",
bottomShownLatch.await(TIMEOUT, TimeUnit.MILLISECONDS));

runAndWait(() -> {
// Top stage, will be inconified
topStage = getStage(true);
topStage.initStyle(stageStyle);
Expand All @@ -79,18 +85,14 @@ public void canIconifyStage(StageStyle stageStyle, boolean resizable) throws Exc
topStage.setScene(topScene);
topStage.setX(0);
topStage.setY(0);
topStage.setOnShown(e -> Platform.runLater(shownLatch::countDown));
topStage.setOnShown(e -> Platform.runLater(topShownLatch::countDown));
topStage.show();
});

assertTrue("Timeout waiting for stages to be shown",
shownLatch.await(TIMEOUT, TimeUnit.MILLISECONDS));

runAndWait(() -> {
topStage.toFront();
});
assertTrue("Timeout waiting for top stage to be shown",
topShownLatch.await(TIMEOUT, TimeUnit.MILLISECONDS));

sleep(500);
sleep(1000);
runAndWait(() -> {
assertFalse(topStage.isIconified());
Color color = getColor(100, 100);
Expand All @@ -101,7 +103,7 @@ public void canIconifyStage(StageStyle stageStyle, boolean resizable) throws Exc
topStage.setIconified(true);
});

sleep(500);
sleep(1000);
runAndWait(() -> {
assertTrue(topStage.isIconified());
Color color = getColor(100, 100);
Expand All @@ -112,7 +114,7 @@ public void canIconifyStage(StageStyle stageStyle, boolean resizable) throws Exc
topStage.setIconified(false);
});

sleep(500);
sleep(1000);
runAndWait(() -> {
assertFalse(topStage.isIconified());
Color color = getColor(100, 100);
Expand Down

3 comments on commit 30147d2

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kevinrushforth
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/tag 20+12

@openjdk
Copy link

@openjdk openjdk bot commented on 30147d2 Dec 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kevinrushforth The tag 20+12 was successfully created.

Please sign in to comment.