Ejemplo n.º 1
0
  @Test
  public void testReadData_TextAndSelection() {
    Fixture.fakeSetParameter(getId(combo), "text", "abc");
    Fixture.fakeSetParameter(getId(combo), "selectionStart", Integer.valueOf(1));
    Fixture.fakeSetParameter(getId(combo), "selectionLength", Integer.valueOf(1));

    lca.readData(combo);

    assertEquals(new Point(1, 2), combo.getSelection());
  }
Ejemplo n.º 2
0
  @Test
  public void testReadData_Text() {
    Fixture.fakeSetParameter(getId(combo), "text", "abc");

    lca.readData(combo);

    assertEquals("abc", combo.getText());
  }
Ejemplo n.º 3
0
  @Test
  public void testReadData_SelectedItem() {
    combo.add("item 1");
    combo.add("item 2");

    Fixture.fakeSetParameter(getId(combo), "selectionIndex", Integer.valueOf(1));
    lca.readData(combo);

    assertEquals(1, combo.getSelectionIndex());
  }
Ejemplo n.º 4
0
  @Test
  public void testReadData_ListVisible() {
    combo.add("item 1");
    combo.add("item 2");

    Fixture.fakeSetParameter(getId(combo), "listVisible", Boolean.TRUE);
    lca.readData(combo);

    assertTrue(combo.getListVisible());
  }
Ejemplo n.º 5
0
  @Test
  public void testTextIsNotRenderdBack() {
    Fixture.markInitialized(display);
    Fixture.markInitialized(shell);
    Fixture.markInitialized(combo);

    Fixture.fakeSetParameter(getId(combo), "text", "some text");
    Fixture.executeLifeCycleFromServerThread();

    // ensure that no text is sent back to the client
    Message message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(combo, "text"));
    assertEquals("some text", combo.getText());
  }
Ejemplo n.º 6
0
  @Test
  public void testReadText_WithVerifyListener() {
    Fixture.fakePhase(PhaseId.PROCESS_ACTION);
    Fixture.markInitialized(display);
    Fixture.markInitialized(shell);
    Fixture.markInitialized(combo);
    combo.setText("some text");
    VerifyListener listener = mock(VerifyListener.class);
    combo.addVerifyListener(listener);

    Fixture.fakeSetParameter(getId(combo), "text", "verify me");
    Fixture.executeLifeCycleFromServerThread();

    assertEquals("verify me", combo.getText());
    ArgumentCaptor<VerifyEvent> captor = ArgumentCaptor.forClass(VerifyEvent.class);
    verify(listener, times(1)).verifyText(captor.capture());
    VerifyEvent event = captor.getValue();
    assertEquals("verify me", event.text);
    assertEquals(0, event.start);
    assertEquals(9, event.end);
  }
Ejemplo n.º 7
0
 private void fakeTextAndSelectionParameters(String text, int start, int length) {
   Fixture.fakeSetParameter(getId(combo), "text", text);
   Fixture.fakeSetParameter(getId(combo), "selectionStart", Integer.valueOf(start));
   Fixture.fakeSetParameter(getId(combo), "selectionLength", Integer.valueOf(length));
 }