modules/graphics/src/test/java/test/javafx/scene/effect/EffectsTestBase.java

Print this page
rev 9250 : 8134762: Refactor Javafx graphics module tests for clear separation of tests
Reviewed-by:


   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.effect;
  27 
  28 import static org.junit.Assert.assertEquals;
  29 
  30 import java.lang.reflect.Method;
  31 
  32 import javafx.beans.property.BooleanProperty;
  33 import javafx.beans.property.DoubleProperty;
  34 import javafx.beans.property.IntegerProperty;
  35 import javafx.beans.property.ObjectProperty;
  36 import javafx.beans.property.SimpleBooleanProperty;
  37 import javafx.beans.property.SimpleDoubleProperty;
  38 import javafx.beans.property.SimpleIntegerProperty;
  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.paint.Color;
  44 import javafx.scene.shape.Rectangle;
  45 import javafx.stage.Stage;
  46 
  47 import com.sun.javafx.pgstub.StubToolkit;
  48 import com.sun.javafx.tk.Toolkit;
  49 import com.sun.scenario.effect.Color4f;


  50 
  51 public class EffectsTestBase {
  52     private Scene scene;
  53     private StubToolkit toolkit;
  54     private Stage stage;
  55     protected Node n;
  56     private Effect e;
  57     
  58     protected void setupTest(Effect effect) {
  59         e = effect;
  60         Group root = new Group();
  61         scene = new Scene(root);
  62         stage = new Stage();
  63         stage.setScene(scene);
  64         stage.show();
  65         toolkit = (StubToolkit) Toolkit.getToolkit(); 
  66         n = new Rectangle(100, 100);
  67         n.setEffect(effect);
  68         root.getChildren().add(n);
  69     }




   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.effect;
  27 
  28 import static org.junit.Assert.assertEquals;
  29 
  30 import java.lang.reflect.Method;
  31 
  32 import javafx.beans.property.BooleanProperty;
  33 import javafx.beans.property.DoubleProperty;
  34 import javafx.beans.property.IntegerProperty;
  35 import javafx.beans.property.ObjectProperty;
  36 import javafx.beans.property.SimpleBooleanProperty;
  37 import javafx.beans.property.SimpleDoubleProperty;
  38 import javafx.beans.property.SimpleIntegerProperty;
  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.paint.Color;
  44 import javafx.scene.shape.Rectangle;
  45 import javafx.stage.Stage;
  46 
  47 import test.com.sun.javafx.pgstub.StubToolkit;
  48 import com.sun.javafx.tk.Toolkit;
  49 import com.sun.scenario.effect.Color4f;
  50 import javafx.scene.effect.BoxBlur;
  51 import javafx.scene.effect.Effect;
  52 
  53 public class EffectsTestBase {
  54     private Scene scene;
  55     private StubToolkit toolkit;
  56     private Stage stage;
  57     protected Node n;
  58     private Effect e;
  59     
  60     protected void setupTest(Effect effect) {
  61         e = effect;
  62         Group root = new Group();
  63         scene = new Scene(root);
  64         stage = new Stage();
  65         stage.setScene(scene);
  66         stage.show();
  67         toolkit = (StubToolkit) Toolkit.getToolkit(); 
  68         n = new Rectangle(100, 100);
  69         n.setEffect(effect);
  70         root.getChildren().add(n);
  71     }