modules/graphics/src/test/java/test/javafx/scene/input/RotateEventTest.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 RotateEventTest {
  42 
  43     private boolean rotated;
  44     private boolean rotated2;
  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         RotateEvent e = new RotateEvent(


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


   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.RotateEvent;
  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 RotateEventTest {
  46 
  47     private boolean rotated;
  48     private boolean rotated2;
  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         RotateEvent e = new RotateEvent(


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