Package com.google.gwt.user.client.Event

Examples of com.google.gwt.user.client.Event.NativePreviewEvent


   * Test the accessors in {@link NativePreviewEvent}.
   */
  public void testNativePreviewEventAccessors() {
    // cancelNativeEvent
    {
      NativePreviewEvent event = new NativePreviewEvent();
      assertFalse(event.isCanceled());
      event.cancel();
      assertTrue(event.isCanceled());
    }

    // preventCancelNativeEvent
    {
      NativePreviewEvent event = new NativePreviewEvent();
      assertFalse(event.isConsumed());
      event.consume();
      assertTrue(event.isConsumed());
    }

    // revive
    {
      NativePreviewEvent event = new NativePreviewEvent();
      event.cancel();
      event.consume();
      assertTrue(event.isCanceled());
      assertTrue(event.isConsumed());
      event.revive();
      assertFalse(event.isCanceled());
      assertFalse(event.isConsumed());
    }
  }
View Full Code Here


public class MockingOverlayInnerTypeTest extends GwtTestTest {

   @Test
   public void withEasyMock() {
      // Act
      NativePreviewEvent event = EasyMock.createMock(NativePreviewEvent.class);

      // Assert
      assertThat(event).isNotNull();
   }
View Full Code Here

   public void withMockito() {
      // Arrange
      // see MockNamePatcher

      // Act
      NativePreviewEvent event = Mockito.mock(NativePreviewEvent.class);

      // Assert
      assertThat(event).isNotNull();
   }
View Full Code Here

                is((int) 'Y'));
    }

    @Test
    public void testRespondsToAltY() {
        NativePreviewEvent altYPressed =
                buildNativeKeyDownEvent(new Keys(Keys.ALT_KEY, KEY_CODE_Y));
        mockShortcutDisplayListInteractions();
        keyShortcutPresenter.bind();
        capturedNativePreviewHandler.getValue().onPreviewNativeEvent(
                altYPressed);
View Full Code Here

        verify(mockDisplay).showPanel();
    }

    @Test
    public void testAttentionModeTimesOut() {
        NativePreviewEvent altXPressed =
                buildNativeKeyDownEvent(new Keys(Keys.ALT_KEY, KEY_CODE_X));
        mockShortcutDisplayListInteractions();
        ArgumentCaptor<AttentionModeActivationEvent> eventBusCapture =
                ArgumentCaptor.forClass(AttentionModeActivationEvent.class);
View Full Code Here

        assertThat(eventBusCapture.getAllValues().get(1).isActive(), is(false));
        assertThat(eventBusCapture.getAllValues().size(), is(2));
    }

    private NativePreviewEvent buildNativeKeyDownEvent(Keys keys) {
        NativePreviewEvent mockNativePreviewEvent =
                mock(NativePreviewEvent.class);
        NativeEvent mockNativeEvent = mock(NativeEvent.class);
        when(mockEventWrapper.getTypeInt(mockNativePreviewEvent)).thenReturn(
                KEY_DOWN_TYPE);
        when(mockNativePreviewEvent.getNativeEvent()).thenReturn(
                mockNativeEvent);
        when(mockEventWrapper.createKeys(mockNativeEvent)).thenReturn(keys);
        when(mockEventWrapper.getType(mockNativeEvent)).thenReturn(
                KeyShortcut.KeyEvent.KEY_DOWN.nativeEventType);
        return mockNativePreviewEvent;
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.Event.NativePreviewEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.