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.effect;
27
28 import static org.junit.Assert.assertEquals;
29 import static org.junit.Assert.assertTrue;
30 import static org.junit.Assert.fail;
31
32 import java.lang.reflect.InvocationTargetException;
33 import java.lang.reflect.Method;
34 import java.util.ArrayList;
35 import java.util.Collection;
36 import java.util.List;
37
38 import javafx.beans.property.ObjectProperty;
39 import javafx.beans.property.SimpleObjectProperty;
40 import javafx.scene.Group;
41 import javafx.scene.Node;
42 import javafx.scene.Scene;
43 import javafx.scene.shape.Rectangle;
44 import javafx.stage.Stage;
45
46 import org.junit.Test;
47 import org.junit.runner.RunWith;
48 import org.junit.runners.Parameterized;
49 import org.junit.runners.Parameterized.Parameters;
50
51 import com.sun.javafx.pgstub.StubToolkit;
52 import com.sun.javafx.tk.Toolkit;
53
54 @RunWith(Parameterized.class)
55 public class EffectInputTest {
56 private String effect1Name = null;
57 private String effect2Name = null;
58 private Node n = null;
59
60 final static String[] effects = new String[] {
61 "Bloom", "BoxBlur", "ColorAdjust", "DisplacementMap",
62 "DropShadow", "GaussianBlur", "Glow", "InnerShadow",
63 "MotionBlur", "PerspectiveTransform",
64 "Reflection", "SepiaTone", "Shadow"
65 };
66
67 @Parameters
68 public static Collection parameters() {
69 List list = new ArrayList();
70 for (int i = 0; i < effects.length; i++) {
71 for (int j = i; j < effects.length; j++) {
72 list.add(new String[] { effects[i], effects[j] });
73 }
74 }
75 return list;
76 }
77
78 public EffectInputTest(final String effect1,
79 final String effect2) {
80 this.effect1Name = effect1;
81 this.effect2Name = effect2;
82 Group root = new Group();
83 Scene scene = new Scene(root);
84 Stage stage = new Stage();
85 stage.setScene(scene);
86 stage.show();
87 n = new Rectangle();
88 root.getChildren().add(n);
89 }
90
91 private void pulse() {
92 ((StubToolkit) Toolkit.getToolkit()).fireTestPulse();
93 }
94
95 private Method getPGInputMethod(String effectName) throws Exception {
96 if (effectName.equals("Shadow")) {
97 effectName = "GeneralShadow";
98 }
99 final Class pgEffectClass = Class.forName("com.sun.scenario.effect." + effectName);
100 if (effectName.equals("InnerShadow")
101 || effectName.equals("DropShadow")
102 || effectName.equals("DisplacementMap")) {
103 return pgEffectClass.getMethod("getContentInput");
104 } else {
105 return pgEffectClass.getMethod("getInput");
106 }
107 }
108
|
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.effect;
27
28 import static org.junit.Assert.assertEquals;
29 import static org.junit.Assert.assertTrue;
30 import static org.junit.Assert.fail;
31
32 import java.lang.reflect.InvocationTargetException;
33 import java.lang.reflect.Method;
34 import java.util.ArrayList;
35 import java.util.Collection;
36 import java.util.List;
37
38 import com.sun.javafx.FXUnit;
39 import javafx.beans.property.ObjectProperty;
40 import javafx.beans.property.SimpleObjectProperty;
41 import javafx.scene.Group;
42 import javafx.scene.Node;
43 import javafx.scene.Scene;
44 import javafx.scene.shape.Rectangle;
45 import javafx.stage.Stage;
46
47 import org.junit.Rule;
48 import org.junit.Test;
49 import org.junit.runner.RunWith;
50 import org.junit.runners.Parameterized;
51 import org.junit.runners.Parameterized.Parameters;
52
53 import com.sun.javafx.pgstub.StubToolkit;
54 import com.sun.javafx.tk.Toolkit;
55
56 @RunWith(Parameterized.class)
57 public class EffectInputTest {
58
59 @Rule
60 public FXUnit fx = new FXUnit();
61
62 private String effect1Name = null;
63 private String effect2Name = null;
64 private Node n = null;
65
66 final static String[] effects = new String[] {
67 "Bloom", "BoxBlur", "ColorAdjust", "DisplacementMap",
68 "DropShadow", "GaussianBlur", "Glow", "InnerShadow",
69 "MotionBlur", "PerspectiveTransform",
70 "Reflection", "SepiaTone", "Shadow"
71 };
72
73 @Parameters
74 public static Collection parameters() {
75 List list = new ArrayList();
76 for (int i = 0; i < effects.length; i++) {
77 for (int j = i; j < effects.length; j++) {
78 list.add(new String[] { effects[i], effects[j] });
79 }
80 }
81 return list;
82 }
83
84 public EffectInputTest(final String effect1,
85 final String effect2) {
86 fx.invokeAndWait(() -> {
87 this.effect1Name = effect1;
88 this.effect2Name = effect2;
89 Group root = new Group();
90 Scene scene = new Scene(root);
91 Stage stage = new Stage();
92 stage.setScene(scene);
93 stage.show();
94 n = new Rectangle();
95 root.getChildren().add(n);
96 });
97 }
98
99 private void pulse() {
100 ((StubToolkit) Toolkit.getToolkit()).fireTestPulse();
101 }
102
103 private Method getPGInputMethod(String effectName) throws Exception {
104 if (effectName.equals("Shadow")) {
105 effectName = "GeneralShadow";
106 }
107 final Class pgEffectClass = Class.forName("com.sun.scenario.effect." + effectName);
108 if (effectName.equals("InnerShadow")
109 || effectName.equals("DropShadow")
110 || effectName.equals("DisplacementMap")) {
111 return pgEffectClass.getMethod("getContentInput");
112 } else {
113 return pgEffectClass.getMethod("getInput");
114 }
115 }
116
|