modules/graphics/src/test/java/javafx/scene/input/SwipeEventTest.java

Print this page
rev 6167 : RT-35330 [Monocle] Remove StubToolkit and replace it with headless glass implementation


   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.Test;
  38 import static org.junit.Assert.*;
  39 
  40 public class SwipeEventTest {
  41 



  42     private boolean swiped;
  43     private boolean swiped2;
  44 
  45     @Test public void testShortConstructor() {
  46         Rectangle node = new Rectangle();
  47         node.setTranslateX(3);
  48         node.setTranslateY(2);
  49         node.setTranslateZ(50);
  50 
  51         PickResult pickRes = new PickResult(node, new Point3D(15, 25, 100), 33);
  52         SwipeEvent e = new SwipeEvent(
  53                 SwipeEvent.SWIPE_UP, 10, 20, 30, 40,
  54                 false, true, false, true, false, 3, pickRes);
  55 
  56         assertSame(SwipeEvent.SWIPE_UP, e.getEventType());
  57         assertSame(pickRes, e.getPickResult());
  58         assertEquals(18, e.getX(), 10e-20);
  59         assertEquals(27, e.getY(), 10e-20);
  60         assertEquals(150, e.getZ(), 10e-20);
  61         assertEquals(10, e.getSceneX(), 10e-20);




   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.FXUnit;
  29 import com.sun.javafx.pgstub.StubScene;
  30 import com.sun.javafx.test.MouseEventGenerator;
  31 import javafx.event.Event;
  32 import javafx.event.EventHandler;
  33 import javafx.geometry.Point3D;
  34 import javafx.scene.Group;
  35 import javafx.scene.Scene;
  36 import javafx.scene.shape.Rectangle;
  37 import javafx.stage.Stage;
  38 import org.junit.Rule;
  39 import org.junit.Test;
  40 import static org.junit.Assert.*;
  41 
  42 public class SwipeEventTest {
  43 
  44     @Rule
  45     public FXUnit fx = new FXUnit();
  46 
  47     private boolean swiped;
  48     private boolean swiped2;
  49 
  50     @Test public void testShortConstructor() {
  51         Rectangle node = new Rectangle();
  52         node.setTranslateX(3);
  53         node.setTranslateY(2);
  54         node.setTranslateZ(50);
  55 
  56         PickResult pickRes = new PickResult(node, new Point3D(15, 25, 100), 33);
  57         SwipeEvent e = new SwipeEvent(
  58                 SwipeEvent.SWIPE_UP, 10, 20, 30, 40,
  59                 false, true, false, true, false, 3, pickRes);
  60 
  61         assertSame(SwipeEvent.SWIPE_UP, e.getEventType());
  62         assertSame(pickRes, e.getPickResult());
  63         assertEquals(18, e.getX(), 10e-20);
  64         assertEquals(27, e.getY(), 10e-20);
  65         assertEquals(150, e.getZ(), 10e-20);
  66         assertEquals(10, e.getSceneX(), 10e-20);