예제 #1
0
  @Test
  public void testCButton_StringIcon() throws InterruptedException, InvocationTargetException {
    CButton button = getButton("St[a]rt", (Icon) null);
    assertThat(button.getMnemonic()).isEqualTo(KeyEvent.VK_A);
    assertThat(button.getText()).isEqualTo("Start");

    button = getButton("St[ar]t", (Icon) null);
    assertThat(button.getText()).isEqualTo("St[ar]t");

    button = getButton("Star[t]", (Icon) null);
    assertThat(button.getMnemonic()).isEqualTo(KeyEvent.VK_T);
    assertThat(button.getText()).isEqualTo("Start");

    button = getButton("[S]tart", (Icon) null);
    assertThat(button.getMnemonic()).isEqualTo(KeyEvent.VK_S);
    assertThat(button.getText()).isEqualTo("Start");
  }
예제 #2
0
  @Test
  public void testSetTextString() throws InterruptedException, InvocationTargetException {
    final CButton button = getButton();
    setText(button, "St[a]rt");
    assertThat(button.getMnemonic()).isEqualTo(KeyEvent.VK_A);
    assertThat(button.getText()).isEqualTo("Start");

    setText(button, "St[ar]t");
    assertThat(button.getMnemonic()).isEqualTo(KeyEvent.VK_A);
    assertThat(button.getText()).isEqualTo("St[ar]t");

    setText(button, "Star[t]");
    assertThat(button.getMnemonic()).isEqualTo(KeyEvent.VK_T);
    assertThat(button.getText()).isEqualTo("Start");

    setText(button, "[S]tart");
    assertThat(button.getMnemonic()).isEqualTo(KeyEvent.VK_S);
    assertThat(button.getText()).isEqualTo("Start");

    setText(button, null);
    assertThat(button.getMnemonic()).isEqualTo(KeyEvent.VK_S);
    assertThat(button.getText()).isNull();
  }