コード例 #1
0
  @Test
  public void testSimpleTouchStartAndCancel() {
    tapRecognizer.onTouchStart(new MockTouchStartEvent(0, 1, 2));
    tapRecognizer.onTouchCanceled(new MockTouchCancelEvent());

    GwtEvent<?> event = mockHasHandlers.getEvent();

    Assert.assertNull(event);
  }
コード例 #2
0
  @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);
  }
コード例 #3
0
  @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());
  }
コード例 #4
0
 @Test
 public void testTapRecognizerDistance() {
   Assert.assertEquals(distance, tapRecognizer.getDistance());
 }