1 /* 2 * Copyright (c) 2011, 2015, 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 test.javafx.scene; 27 28 import java.util.Arrays; 29 import java.util.Collection; 30 31 import javafx.event.Event; 32 import javafx.event.EventHandler; 33 import javafx.geometry.Point2D; 34 import javafx.scene.effect.BlendMode; 35 import javafx.scene.effect.Glow; 36 import javafx.scene.input.InputMethodRequests; 37 import javafx.scene.shape.Rectangle; 38 import javafx.scene.transform.Rotate; 39 40 import org.junit.runner.RunWith; 41 import org.junit.runners.Parameterized; 42 import org.junit.runners.Parameterized.Parameters; 43 44 import com.sun.javafx.event.EventHandlerManager; 45 import test.com.sun.javafx.test.PropertiesTestBase; 46 import javafx.geometry.NodeOrientation; 47 import javafx.scene.CacheHint; 48 import javafx.scene.Cursor; 49 import javafx.scene.DepthTest; 50 import javafx.scene.Group; 51 import javafx.scene.Node; 52 53 @RunWith(Parameterized.class) 54 public final class Node_properties_Test extends PropertiesTestBase { 55 @Parameters 56 public static Collection data() { 57 final Group testParent = new Group(); 58 final Node testNode = new Rectangle(); 59 testParent.getChildren().add(testNode); 60 61 final EventHandler testEventHandler = 62 event -> { 63 }; 64 65 return Arrays.asList(new Object[] { 66 // config(testNode, "parent", , ), 67 // config(testNode, "scene", , ), 68 config(testNode, "id", "rect_1", "rect_2"), 69 config(testNode, "style", "style_1", "style_2"), 70 config(testNode, "visible", true, false), 71 config(testNode, "cursor", Cursor.DEFAULT, Cursor.CROSSHAIR), 72 config(testNode, "opacity", 1.0, 0.5), 73 config(testNode, "priorityOrder", 0.0, 0.5), 74 config(testNode, "blendMode", 75 BlendMode.SRC_OVER, BlendMode.SRC_ATOP), 76 config(testNode, "clip", null, new Rectangle(0, 0, 100, 100)), 77 config(testNode, "cache", false, true), 78 config(testNode, "cacheHint", CacheHint.QUALITY, CacheHint.SPEED), 79 config(testNode, "effect", null, new Glow()), 80 config(testNode, "depthTest", DepthTest.DISABLE, DepthTest.ENABLE), 81 config(testNode, "disable", false, true), 82 config(testNode, "pickOnBounds", false, true), 83 config(testParent, "disable", false, true, 84 testNode, "disabled", false, true), 85 config(testNode, "onDragEntered", null, testEventHandler), 86 config(testNode, "onDragExited", null, testEventHandler), 87 config(testNode, "onDragOver", null, testEventHandler), 88 config(testNode, "onDragDropped", null, testEventHandler), 89 config(testNode, "onDragDone", null, testEventHandler), 90 config(testNode, "managed", false, true), 91 config(testNode, "layoutX", 0.0, 100.0), 92 config(testNode, "layoutY", 0.0, 100.0), 93 // config(testNode, "boundsInParent", , ), 94 // config(testNode, "boundsInLocal", , ), 95 // config(testNode, "layoutBounds", , ), 96 // config(testNode, "transforms", , ), 97 config(testNode, "translateX", 0.0, 100.0), 98 config(testNode, "translateY", 0.0, 100.0), 99 config(testNode, "translateZ", 0.0, 100.0), 100 config(testNode, "scaleX", 1.0, 0.5), 101 config(testNode, "scaleY", 1.0, 0.5), 102 config(testNode, "scaleZ", 1.0, 0.5), 103 config(testNode, "rotate", 0.0, 45.0), 104 config(testNode, "rotationAxis", Rotate.Z_AXIS, Rotate.X_AXIS), 105 config(testNode, "mouseTransparent", false, true), 106 // config(testNode, "hover", , ), 107 // config(testNode, "pressed", , ), 108 config(testNode, "onMouseClicked", null, testEventHandler), 109 config(testNode, "onMouseDragged", null, testEventHandler), 110 config(testNode, "onMouseEntered", null, testEventHandler), 111 config(testNode, "onMouseExited", null, testEventHandler), 112 config(testNode, "onMouseMoved", null, testEventHandler), 113 config(testNode, "onMousePressed", null, testEventHandler), 114 config(testNode, "onMouseReleased", null, testEventHandler), 115 config(testNode, "onDragDetected", null, testEventHandler), 116 config(testNode, "onKeyPressed", null, testEventHandler), 117 config(testNode, "onKeyReleased", null, testEventHandler), 118 config(testNode, "onKeyTyped", null, testEventHandler), 119 config(testNode, "onInputMethodTextChanged", 120 null, testEventHandler), 121 config(testNode, "inputMethodRequests", 122 null, 123 new InputMethodRequests() { 124 @Override 125 public Point2D getTextLocation(final int offset) { 126 return new Point2D(0, 0); 127 } 128 129 @Override 130 public int getLocationOffset(final int x, final int y) { 131 return 0; 132 } 133 134 @Override 135 public void cancelLatestCommittedText() { 136 } 137 138 @Override 139 public String getSelectedText() { 140 return ""; 141 } 142 }), 143 // config(testNode, "focused", , ), 144 config(testNode, "focusTraversable", false, true), 145 // config(testNode, "treeVisible", , ), 146 config(testNode, "eventDispatcher", 147 null, 148 new EventHandlerManager(null)), 149 config(testNode, 150 "nodeOrientation", NodeOrientation.INHERIT, 151 NodeOrientation.RIGHT_TO_LEFT, 152 "effectiveNodeOrientation", NodeOrientation.LEFT_TO_RIGHT, 153 NodeOrientation.RIGHT_TO_LEFT), 154 config(testParent, "nodeOrientation", 155 NodeOrientation.LEFT_TO_RIGHT, 156 NodeOrientation.RIGHT_TO_LEFT, 157 testNode, "effectiveNodeOrientation", 158 NodeOrientation.LEFT_TO_RIGHT, 159 NodeOrientation.RIGHT_TO_LEFT) 160 }); 161 } 162 163 public Node_properties_Test(final Configuration configuration) { 164 super(configuration); 165 } 166 }