@Test public void testSimpleTouchStartAndCancel() { tapRecognizer.onTouchStart(new MockTouchStartEvent(0, 1, 2)); tapRecognizer.onTouchCanceled(new MockTouchCancelEvent()); GwtEvent<?> event = mockHasHandlers.getEvent(); Assert.assertNull(event); }
@Test public void testSimpleTouchStartWithMoveAndEndNoTapRcognized1() { tapRecognizer.onTouchStart(new MockTouchStartEvent(0, 1, 2)); tapRecognizer.onTouchMove(new MockTouchMoveEvent(0, 1 - distance - 1, 2 - distance - 1)); tapRecognizer.onTouchEnd(new MockTouchEndEvent()); GwtEvent<?> event = mockHasHandlers.getEvent(); Assert.assertNull(event); }
@Test public void testSimpleTouchStartAndEnd() { tapRecognizer.onTouchStart(new MockTouchStartEvent(0, 1, 2)); tapRecognizer.onTouchEnd(new MockTouchEndEvent()); GwtEvent<?> event = mockHasHandlers.getEvent(); if (!(event instanceof TapEvent)) { Assert.fail("no tap recognized"); } TapEvent tapEvent = (TapEvent) event; Assert.assertEquals(1, tapEvent.getStartX()); Assert.assertEquals(2, tapEvent.getStartY()); Assert.assertSame(mockHasHandlers, tapEvent.getSource()); }
@Test public void testTapRecognizerDistance() { Assert.assertEquals(distance, tapRecognizer.getDistance()); }