< prev index next >
tests/system/src/test/java/test/javafx/scene/RestoreSceneSizeTest.java
Print this page
*** 44,55 ****
import static org.junit.Assume.assumeTrue;
public class RestoreSceneSizeTest {
static CountDownLatch startupLatch;
static Stage stage;
! static double w;
! static double h;
public static void main(String[] args) throws Exception {
initFX();
try {
RestoreSceneSizeTest test = new RestoreSceneSizeTest();
--- 44,58 ----
import static org.junit.Assume.assumeTrue;
public class RestoreSceneSizeTest {
static CountDownLatch startupLatch;
static Stage stage;
! static double w, h;
!
! private static final int WIDTH = 234;
! private static final int HEIGHT = 255;
! private static double scaleX, scaleY;
public static void main(String[] args) throws Exception {
initFX();
try {
RestoreSceneSizeTest test = new RestoreSceneSizeTest();
*** 63,79 ****
public static class TestApp extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
! primaryStage.setScene(new Scene(new VBox(), 234, 255));
stage = primaryStage;
- w = stage.getScene().getWidth();
- h = stage.getScene().getHeight();
stage.setFullScreen(true);
! stage.addEventHandler(WindowEvent.WINDOW_SHOWN, e ->
! Platform.runLater(startupLatch::countDown));
stage.show();
}
}
@BeforeClass
--- 66,84 ----
public static class TestApp extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
! primaryStage.setScene(new Scene(new VBox(), WIDTH, HEIGHT));
stage = primaryStage;
stage.setFullScreen(true);
! stage.addEventHandler(WindowEvent.WINDOW_SHOWN, e -> {
! scaleX = stage.getOutputScaleX​();
! scaleY = stage.getOutputScaleY();
!
! Platform.runLater(startupLatch::countDown);
! });
stage.show();
}
}
@BeforeClass
*** 89,103 ****
}
}
@Test
public void testUnfullscreenSize() throws Exception {
- assumeTrue(Boolean.getBoolean("unstable.test")); // JDK-8193185
// Disable on Mac until JDK-8176813 is fixed
assumeTrue(!PlatformUtil.isMac());
Thread.sleep(200);
Assert.assertTrue(stage.isShowing());
Assert.assertTrue(stage.isFullScreen());
CountDownLatch latch = new CountDownLatch(2);
ChangeListener<Number> listenerW = (observable, oldValue, newValue) -> {
--- 94,109 ----
}
}
@Test
public void testUnfullscreenSize() throws Exception {
// Disable on Mac until JDK-8176813 is fixed
assumeTrue(!PlatformUtil.isMac());
Thread.sleep(200);
+ w = (Math.ceil(WIDTH * scaleX)) / scaleX;
+ h = (Math.ceil(HEIGHT * scaleY)) / scaleY;
Assert.assertTrue(stage.isShowing());
Assert.assertTrue(stage.isFullScreen());
CountDownLatch latch = new CountDownLatch(2);
ChangeListener<Number> listenerW = (observable, oldValue, newValue) -> {
< prev index next >