1 /*
   2  * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   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 
  26 package javafx.scene;
  27 
  28 import com.sun.javafx.cursor.CursorFrame;
  29 import com.sun.javafx.event.EventHandlerManager;
  30 import java.util.Arrays;
  31 import java.util.Collection;
  32 import javafx.event.Event;
  33 import javafx.event.EventHandler;
  34 import javafx.geometry.NodeOrientation;
  35 import javafx.scene.paint.Color;
  36 
  37 import org.junit.runner.RunWith;
  38 import org.junit.runners.Parameterized;
  39 import org.junit.runners.Parameterized.Parameters;
  40 
  41 import com.sun.javafx.test.PropertiesTestBase;
  42 import com.sun.javafx.test.PropertiesTestBase.Configuration;
  43 import com.sun.javafx.test.objects.TestScene;
  44 import com.sun.javafx.test.objects.TestStage;
  45 import javafx.scene.layout.Pane;
  46 
  47 @RunWith(Parameterized.class)
  48 public final class Scene_properties_Test extends PropertiesTestBase {
  49     @Parameters
  50     public static Collection data() {
  51         final TestScene testScene = new TestScene(new Group());
  52 
  53         final TestStage testStage1 = new TestStage("STAGE_1");
  54         final TestStage testStage2 = new TestStage("STAGE_2");
  55         
  56         final EventHandler testEventHandler =
  57                 event -> {
  58                 };
  59         
  60         final Configuration windowCfg =
  61             new Configuration(testScene,
  62                               "_window", testStage1, testStage2,
  63                               "window", testStage1, testStage2);
  64         windowCfg.setAllowMultipleNotifications(true);
  65 
  66         return Arrays.asList(new Object[] {
  67             config(windowCfg),
  68 //            config(testScene, "x", , ),
  69 //            config(testScene, "y", , ),
  70 //            config(testScene, "width", , ),
  71 //            config(testScene, "height", , ),
  72             config(testScene, "camera", null, new ParallelCamera()),
  73             config(testScene, "fill", Color.WHITE, Color.BLACK),
  74             config(testScene, "fill", null, Color.TRANSPARENT),
  75             config(testScene, "root", new Group(), new Pane()),
  76             config(testScene, "cursor", null, new Cursor("TestCursor") {
  77                 @Override public CursorFrame getCurrentFrame() {
  78                     throw new UnsupportedOperationException("Not supported yet.");
  79                 }
  80             }),
  81             config(testScene, "cursor", Cursor.DEFAULT, Cursor.CROSSHAIR),
  82             config(testScene, "eventDispatcher",
  83                    null,
  84                    new EventHandlerManager(null)),
  85             config(testScene, "camera", null, new PerspectiveCamera()),
  86             config(testScene, "onMouseClicked", null, testEventHandler),
  87             config(testScene, "onMouseDragged", null, testEventHandler),
  88             config(testScene, "onMouseEntered", null, testEventHandler),
  89             config(testScene, "onMouseExited", null, testEventHandler),
  90             config(testScene, "onMouseMoved", null, testEventHandler),
  91             config(testScene, "onMousePressed", null, testEventHandler),
  92             config(testScene, "onMouseReleased", null, testEventHandler),
  93             config(testScene, "onDragDetected", null, testEventHandler),
  94             config(testScene, "onDragEntered", null, testEventHandler),
  95             config(testScene, "onDragExited", null, testEventHandler),
  96             config(testScene, "onDragOver", null, testEventHandler),
  97             config(testScene, "onDragDropped", null, testEventHandler),
  98             config(testScene, "onDragDone", null, testEventHandler),
  99             config(testScene, "onKeyPressed", null, testEventHandler),
 100             config(testScene, "onKeyReleased", null, testEventHandler),
 101             config(testScene, "onKeyTyped", null, testEventHandler),
 102             config(testScene, "onContextMenuRequested", null, testEventHandler),
 103             config(testScene, "onDragDetected", null, testEventHandler),
 104             config(testScene, "onDragDone", null, testEventHandler),
 105             config(testScene, "onDragDropped", null, testEventHandler),
 106             config(testScene, "onDragEntered", null, testEventHandler),
 107             config(testScene, "onDragExited", null, testEventHandler),
 108             config(testScene, "onDragOver", null, testEventHandler),
 109             config(testScene, "onMouseDragEntered", null, testEventHandler),
 110             config(testScene, "onMouseDragExited", null, testEventHandler),
 111             config(testScene, "onMouseDragOver", null, testEventHandler),
 112             config(testScene, "onMouseDragReleased", null, testEventHandler),
 113             config(testScene, "onRotate", null, testEventHandler),
 114             config(testScene, "onRotationStarted", null, testEventHandler),
 115             config(testScene, "onRotationFinished", null, testEventHandler),
 116             config(testScene, "onZoom", null, testEventHandler),
 117             config(testScene, "onZoomStarted", null, testEventHandler),
 118             config(testScene, "onZoomFinished", null, testEventHandler),
 119             config(testScene, "onScroll", null, testEventHandler),
 120             config(testScene, "onScrollStarted", null, testEventHandler),
 121             config(testScene, "onScrollFinished", null, testEventHandler),
 122             config(testScene, "onSwipeLeft", null, testEventHandler),
 123             config(testScene, "onSwipeRight", null, testEventHandler),
 124             config(testScene, "onSwipeUp", null, testEventHandler),
 125             config(testScene, "onSwipeDown", null, testEventHandler),
 126             config(testScene, "onTouchPressed", null, testEventHandler),
 127             config(testScene, "onTouchReleased", null, testEventHandler),
 128             config(testScene, "onTouchMoved", null, testEventHandler),
 129             config(testScene, "onTouchStationary", null, testEventHandler),
 130             config(testScene, "onInputMethodTextChanged",
 131                    null, testEventHandler),
 132             config(testScene,
 133                    "nodeOrientation", NodeOrientation.INHERIT,
 134                                       NodeOrientation.RIGHT_TO_LEFT,
 135                    "effectiveNodeOrientation", NodeOrientation.LEFT_TO_RIGHT,
 136                                                NodeOrientation.RIGHT_TO_LEFT)
 137         });
 138     }
 139 
 140     public Scene_properties_Test(final Configuration configuration) {
 141         super(configuration);
 142     }
 143 }