Exemplo n.º 1
0
  @Test
  public void unhandledInheritableEventsArePassedToParent() throws Exception {
    parent.getEventHandler().add(MousePressedEvent.class, action);

    panel.getEventHandler().dispatch(new MousePressedEvent(panel, 0, new Point(0, 0), 0));

    assertEquals(true, action.invoked);
    assertEquals(parent, action.recipient);
  }
Exemplo n.º 2
0
  @Test
  public void unhandledNoninheritableEventsAreNotPassedToParent() throws Exception {
    parent.getEventHandler().add(KeyPressedEvent.class, action);

    panel
        .getEventHandler()
        .dispatch(new KeyPressedEvent(panel, 0, KeyEvent.KEY_ENTER, KeyEvent.LOCATION_LEFT));

    assertEquals(false, action.invoked);
  }