Пример #1
0
  /**
   * Tests that for multiple selection, the ridget selection state and the ui selection state cannot
   * be changed by the user when ridget is set to "output only".
   */
  public void testOutputMultipleSelectionCannotBeChangedFromUI() {
    final TableRidget ridget = getRidget();
    final Table control = getWidget();

    ridget.setSelectionType(SelectionType.MULTI);

    assertEquals(0, ridget.getSelection().size());
    assertEquals(0, control.getSelectionCount());

    ridget.setOutputOnly(true);
    control.setFocus();
    // move down and up to select row 0; space does not select in tables
    UITestHelper.sendKeyAction(control.getDisplay(), UITestHelper.KC_ARROW_DOWN);
    UITestHelper.sendKeyAction(control.getDisplay(), UITestHelper.KC_ARROW_UP);

    assertEquals(0, ridget.getSelection().size());
    assertEquals(0, control.getSelectionCount());

    ridget.setOutputOnly(false);
    control.setFocus();
    // move down and up to select row 0; space does not select in tables
    UITestHelper.sendKeyAction(control.getDisplay(), UITestHelper.KC_ARROW_DOWN);
    UITestHelper.sendKeyAction(control.getDisplay(), UITestHelper.KC_ARROW_UP);

    assertEquals(1, ridget.getSelection().size());
    assertEquals(1, control.getSelectionCount());
  }
Пример #2
0
  /** Tests that toggling output state on/off does not change the selection. */
  public void testTogglingOutputDoesNotChangeSelection() {
    final TableRidget ridget = getRidget();

    ridget.setSelection(0);

    assertEquals(0, ridget.getSelectionIndex());

    ridget.setOutputOnly(true);

    assertEquals(0, ridget.getSelectionIndex());

    ridget.setSelection((Object) null);

    assertEquals(-1, ridget.getSelectionIndex());

    ridget.setOutputOnly(false);

    assertEquals(-1, ridget.getSelectionIndex());
  }