Exemplo n.º 1
0
  @Test
  public void consumedFocusGainedEventsShouldNotStartTheCaret() throws Exception {
    assertEquals(false, panel.isCaretBlinking());

    new FocusGainedEvent().consumed().dispatch(panel);

    assertEquals(false, panel.isCaretBlinking());
  }
Exemplo n.º 2
0
  @Test
  public void caretAnimationIsStoppedWhenPanelIsDisowned() throws Exception {
    stage.getKeyListener().focusOn(panel);
    assertEquals(true, panel.isCaretBlinking());

    panel.setParent(null);

    assertEquals(false, panel.isCaretBlinking());
  }
Exemplo n.º 3
0
  @Test
  public void canLoseFocus() {
    stage.getKeyListener().focusOn(panel);
    root.dirtyRegions.clear();
    stage.getKeyListener().focusOn(root);

    assertEquals(false, panel.hasFocus());
    assertEquals(false, panel.isCaretBlinking());
    assertEquals(true, root.dirtyRegions.contains(panel.getBounds()));
    assertEquals(true, root.dirtyRegions.contains(parent.getBounds()));
  }
Exemplo n.º 4
0
  @Test
  public void canGainFocus() {
    assertEquals(0, root.dirtyRegions.size());

    stage.getKeyListener().focusOn(panel);

    assertEquals(true, panel.hasFocus());
    assertEquals(true, panel.isCaretBlinking());
    assertEquals(true, root.dirtyRegions.contains(panel.getBounds()));
    assertEquals(true, root.dirtyRegions.contains(parent.getBounds()));
  }