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 SwipeEventTest {
42
43 private boolean swiped;
44 private boolean swiped2;
45
46 @Test public void testShortConstructor() {
47 Rectangle node = new Rectangle();
48 node.setTranslateX(3);
49 node.setTranslateY(2);
50 node.setTranslateZ(50);
51
52 PickResult pickRes = new PickResult(node, new Point3D(15, 25, 100), 33);
53 SwipeEvent e = new SwipeEvent(
54 SwipeEvent.SWIPE_UP, 10, 20, 30, 40,
396 @Test public void testToString() {
397 SwipeEvent e = new SwipeEvent(SwipeEvent.SWIPE_RIGHT,
398 100, 100, 200, 200,
399 false, false, false, false,
400 true, 3, null);
401
402 String s = e.toString();
403
404 assertNotNull(s);
405 assertFalse(s.isEmpty());
406 }
407
408 private Scene createScene() {
409 final Group root = new Group();
410
411 final Scene scene = new Scene(root, 400, 400);
412
413 Rectangle rect = new Rectangle(100, 100, 100, 100);
414 Rectangle rect2 = new Rectangle(200, 200, 100, 100);
415
416 root.getChildren().addAll(rect, rect2);
417
418 Stage stage = new Stage();
419 stage.setScene(scene);
420 stage.show();
421
422 return scene;
423 }
424 }
|
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.SwipeEvent;
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 SwipeEventTest {
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,
400 @Test public void testToString() {
401 SwipeEvent e = new SwipeEvent(SwipeEvent.SWIPE_RIGHT,
402 100, 100, 200, 200,
403 false, false, false, false,
404 true, 3, null);
405
406 String s = e.toString();
407
408 assertNotNull(s);
409 assertFalse(s.isEmpty());
410 }
411
412 private Scene createScene() {
413 final Group root = new Group();
414
415 final Scene scene = new Scene(root, 400, 400);
416
417 Rectangle rect = new Rectangle(100, 100, 100, 100);
418 Rectangle rect2 = new Rectangle(200, 200, 100, 100);
419
420 ParentShim.getChildren(root).addAll(rect, rect2);
421
422 Stage stage = new Stage();
423 stage.setScene(scene);
424 stage.show();
425
426 return scene;
427 }
428 }
|