boot-fx/src/test/java/net/java/html/boot/fx/FXBrowsersTest.java
changeset 1008 c535c36881af
parent 1006 a0f79e32d526
child 1016 665b10c62f3d
     1.1 --- a/boot-fx/src/test/java/net/java/html/boot/fx/FXBrowsersTest.java	Fri Oct 02 08:57:14 2015 +0200
     1.2 +++ b/boot-fx/src/test/java/net/java/html/boot/fx/FXBrowsersTest.java	Sun Oct 11 07:24:32 2015 +0200
     1.3 @@ -68,7 +68,15 @@
     1.4          new Thread("initFX") {
     1.5              @Override
     1.6              public void run() {
     1.7 -                App.launch(App.class);
     1.8 +                if (Platform.isFxApplicationThread()) {
     1.9 +                    new App().start(new Stage());
    1.10 +                } else {
    1.11 +                    try {
    1.12 +                        App.launch(App.class);
    1.13 +                    } catch (IllegalStateException ex) {
    1.14 +                        Platform.runLater(this);
    1.15 +                    }
    1.16 +                }
    1.17              }
    1.18          }.start();
    1.19          App.CDL.await();
    1.20 @@ -122,7 +130,7 @@
    1.21              @Override
    1.22              public void run() {
    1.23                  assertTrue(Platform.isFxApplicationThread());
    1.24 -                three[0] = App.getV1().getEngine().executeScript("window.cnt");
    1.25 +                three[0] = App.getV1().getEngine().executeScript("window.cntBrwsr");
    1.26                  finish.countDown();
    1.27              }
    1.28          });
    1.29 @@ -173,8 +181,8 @@
    1.30          private static native Object window();
    1.31          
    1.32          @JavaScriptBody(args = {}, body = ""
    1.33 -            + "if (window.cnt) return ++window.cnt;"
    1.34 -            + "return window.cnt = 1;"
    1.35 +            + "if (window.cntBrwsr) return ++window.cntBrwsr;"
    1.36 +            + "return window.cntBrwsr = 1;"
    1.37          )
    1.38          private static native int increment();
    1.39      }
    1.40 @@ -198,7 +206,7 @@
    1.41          }
    1.42  
    1.43          @Override
    1.44 -        public void start(Stage stage) throws Exception {
    1.45 +        public void start(Stage stage) {
    1.46              pane= new BorderPane();
    1.47              Scene scene = new Scene(pane, 800, 600);
    1.48              stage.setScene(scene);