Skip to content

Commit

Permalink
Add test for Height
Browse files Browse the repository at this point in the history
  • Loading branch information
tsayao committed Dec 3, 2024
1 parent b3c453a commit 2cffd52
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,25 @@ public void testSetWidthOnlyAfterShownOnContentSizeWindow() throws Exception {
s.setTitle("Width only after content size window");
sp.setPrefWidth(contentSize);
sp.setPrefHeight(contentSize);
}, (s, sp) -> {
s.setWidth(windowWidth);
});
}, (s, sp) -> s.setWidth(windowWidth));

Assertions.assertEquals(windowWidth, mainStage.getWidth(), "Window width should be " + windowWidth);
}

@Test
public void testSetHeightOnlyAfterShownOnContentSizeWindow() throws Exception {
int contentSize = 300;
int windowHeight = 200;

createStage((s, sp) -> {
s.setTitle("Height only after content size window");
sp.setPrefWidth(contentSize);
sp.setPrefHeight(contentSize);
}, (s, sp) -> s.setHeight(windowHeight));

Assertions.assertEquals(windowHeight, mainStage.getHeight(), "Window height should be " + windowHeight);
}

private void createStage(BiConsumer<Stage, StackPane> beforeShown,
BiConsumer<Stage, StackPane> afterShown) throws InterruptedException {
CountDownLatch showLatch = new CountDownLatch(1);
Expand Down

0 comments on commit 2cffd52

Please sign in to comment.