modules/graphics/src/test/java/javafx/scene/SubSceneTest.java

Print this page
rev 6167 : RT-35330 [Monocle] Remove StubToolkit and replace it with headless glass implementation


   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package javafx.scene;
  26 

  27 import javafx.stage.Stage;
  28 import com.sun.javafx.sg.prism.NGCamera;
  29 import com.sun.javafx.sg.prism.NGSubScene;
  30 import com.sun.javafx.tk.Toolkit;
  31 import javafx.application.Platform;
  32 import javafx.scene.layout.Pane;
  33 import static org.junit.Assert.assertEquals;
  34 import static org.junit.Assert.assertNull;


  35 import org.junit.Test;
  36 import static org.junit.Assert.assertTrue;
  37 import static org.junit.Assert.fail;
  38 
  39 public class SubSceneTest {
  40 



  41     @Test
  42     public void isOnFxAppThread() {
  43         assertTrue(Platform.isFxApplicationThread());
  44     }
  45 
  46     @Test(expected = NullPointerException.class)
  47     public void testNullRoot() {
  48         SubScene subScene = new SubScene(null, 10, 10);
  49     }
  50 
  51     @Test(expected = NullPointerException.class)
  52     public void testSetNullRoot() {
  53         SubScene subScene = new SubScene(new Group(), 10, 10);
  54         subScene.setRoot(null);
  55     }
  56 
  57     @Test
  58     public void testRootInitializedInConstructor() {
  59         Group g = new Group();
  60         SubScene subScene = new SubScene(g, 10, 10);




   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package javafx.scene;
  26 
  27 import com.sun.javafx.FXUnit;

  28 import javafx.stage.Stage;
  29 import com.sun.javafx.sg.prism.NGCamera;
  30 import com.sun.javafx.sg.prism.NGSubScene;
  31 import com.sun.javafx.tk.Toolkit;
  32 import javafx.application.Platform;
  33 import javafx.scene.layout.Pane;
  34 import static org.junit.Assert.assertEquals;
  35 import static org.junit.Assert.assertNull;
  36 

  37 import org.junit.Rule;

  38 import org.junit.Test;
  39 import static org.junit.Assert.assertTrue;
  40 import static org.junit.Assert.fail;
  41 
  42 public class SubSceneTest {
  43 
  44     @Rule

  45     public FXUnit fx = new FXUnit();

  46 

  47     @Test
  48     public void isOnFxAppThread() {
  49         assertTrue(Platform.isFxApplicationThread());
  50     }
  51 
  52     @Test(expected = NullPointerException.class)
  53     public void testNullRoot() {
  54         SubScene subScene = new SubScene(null, 10, 10);
  55     }
  56 
  57     @Test(expected = NullPointerException.class)
  58     public void testSetNullRoot() {
  59         SubScene subScene = new SubScene(new Group(), 10, 10);
  60         subScene.setRoot(null);
  61     }
  62 
  63     @Test
  64     public void testRootInitializedInConstructor() {
  65         Group g = new Group();
  66         SubScene subScene = new SubScene(g, 10, 10);