modules/graphics/src/test/java/test/javafx/scene/input/ZoomEventTest.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.input;
  27 
  28 import com.sun.javafx.pgstub.StubScene;
  29 import com.sun.javafx.test.MouseEventGenerator;
  30 import javafx.event.Event;
  31 import javafx.event.EventHandler;
  32 import javafx.geometry.Point3D;
  33 import javafx.scene.Group;

  34 import javafx.scene.Scene;



  35 import javafx.scene.shape.Rectangle;
  36 import javafx.stage.Stage;
  37 import org.junit.Assert;
  38 import org.junit.Test;
  39 import static org.junit.Assert.*;
  40 
  41 public class ZoomEventTest {
  42 
  43     private boolean zoomed;
  44     private boolean zoomed2;
  45     private PickResult pickRes;
  46 
  47     @Test public void testShortConstructor() {
  48         Rectangle node = new Rectangle();
  49         node.setTranslateX(3);
  50         node.setTranslateY(2);
  51         node.setTranslateZ(50);
  52 
  53         pickRes = new PickResult(node, new Point3D(15, 25, 100), 33);
  54         ZoomEvent e = new ZoomEvent(


 628     @Test public void testToString() {
 629         ZoomEvent e = new ZoomEvent(ZoomEvent.ZOOM,
 630             100, 100, 200, 200,
 631             false, false, false, false,
 632             true, false, 10, 20, null);
 633 
 634         String s = e.toString();
 635 
 636         assertNotNull(s);
 637         assertFalse(s.isEmpty());
 638     }
 639 
 640     private Scene createScene() {
 641         final Group root = new Group();
 642         
 643         final Scene scene = new Scene(root, 400, 400);
 644 
 645         Rectangle rect = new Rectangle(100, 100, 100, 100);
 646         Rectangle rect2 = new Rectangle(200, 200, 100, 100);
 647 
 648         root.getChildren().addAll(rect, rect2);
 649 
 650         Stage stage = new Stage();
 651         stage.setScene(scene);
 652         stage.show();
 653         
 654         return scene;
 655     }
 656 }


   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.input;
  27 
  28 import test.com.sun.javafx.pgstub.StubScene;
  29 import test.com.sun.javafx.test.MouseEventGenerator;
  30 import javafx.event.Event;
  31 import javafx.event.EventHandler;
  32 import javafx.geometry.Point3D;
  33 import javafx.scene.Group;
  34 import javafx.scene.ParentShim;
  35 import javafx.scene.Scene;
  36 import javafx.scene.input.MouseEvent;
  37 import javafx.scene.input.PickResult;
  38 import javafx.scene.input.ZoomEvent;
  39 import javafx.scene.shape.Rectangle;
  40 import javafx.stage.Stage;
  41 import org.junit.Assert;
  42 import org.junit.Test;
  43 import static org.junit.Assert.*;
  44 
  45 public class ZoomEventTest {
  46 
  47     private boolean zoomed;
  48     private boolean zoomed2;
  49     private PickResult pickRes;
  50 
  51     @Test public void testShortConstructor() {
  52         Rectangle node = new Rectangle();
  53         node.setTranslateX(3);
  54         node.setTranslateY(2);
  55         node.setTranslateZ(50);
  56 
  57         pickRes = new PickResult(node, new Point3D(15, 25, 100), 33);
  58         ZoomEvent e = new ZoomEvent(


 632     @Test public void testToString() {
 633         ZoomEvent e = new ZoomEvent(ZoomEvent.ZOOM,
 634             100, 100, 200, 200,
 635             false, false, false, false,
 636             true, false, 10, 20, null);
 637 
 638         String s = e.toString();
 639 
 640         assertNotNull(s);
 641         assertFalse(s.isEmpty());
 642     }
 643 
 644     private Scene createScene() {
 645         final Group root = new Group();
 646         
 647         final Scene scene = new Scene(root, 400, 400);
 648 
 649         Rectangle rect = new Rectangle(100, 100, 100, 100);
 650         Rectangle rect2 = new Rectangle(200, 200, 100, 100);
 651 
 652         ParentShim.getChildren(root).addAll(rect, rect2);
 653 
 654         Stage stage = new Stage();
 655         stage.setScene(scene);
 656         stage.show();
 657         
 658         return scene;
 659     }
 660 }