Пример #1
0
  @Test
  public void newlineIsTyped() throws Exception {
    model.setCaretLocation(TextLocation.origin);
    new CharTypedEvent(0, '\n').dispatch(panel);

    assertEquals("\nSome Text", model.getText());
  }
Пример #2
0
  @Test
  public void backspaceIsNotTyped() throws Exception {
    model.setCaretLocation(TextLocation.origin);
    new CharTypedEvent(0, '\b').dispatch(panel);

    assertEquals("Some Text", model.getText());
  }
Пример #3
0
  @Test
  public void typedCharsWithCommandModifierDoNothing() throws Exception {
    model.setCaretLocation(TextLocation.origin);

    new CharTypedEvent(KeyEvent.COMMAND_MASK, 'A').dispatch(panel);

    assertEquals("Some Text", model.getText());
  }
Пример #4
0
  @Test
  public void typingACharWillInsertIt() throws Exception {
    model.setCaretLocation(TextLocation.origin);

    new CharTypedEvent(0, 'Z').dispatch(panel);

    assertEquals("ZSome Text", model.getText());
  }