Esempio n. 1
0
  public void testSetEnabledStateDisabledParent() {
    Shell shell = new Shell();
    Composite composite = new Composite(shell, SWT.NONE);
    composite.setEnabled(false);
    Label label = new Label(composite, SWT.NONE);

    CommonUiUtil.setEnabled(composite, false);
    assertFalse(composite.getEnabled());
    assertFalse(label.getEnabled());

    CommonUiUtil.setEnabled(composite, true);
    assertFalse(composite.getEnabled());
    assertTrue(label.getEnabled());
  }
Esempio n. 2
0
  public void testSetEnabledStateDisableStateRemoved() {
    Shell shell = new Shell();
    Composite composite = new Composite(shell, SWT.NONE);
    Label label = new Label(composite, SWT.NONE);
    label.setEnabled(false);

    CommonUiUtil.setEnabled(composite, false);
    CommonUiUtil.setEnabled(composite, true);
    // the second call should have not changed anything
    CommonUiUtil.setEnabled(composite, true);
    assertTrue(composite.getEnabled());
    assertFalse(label.getEnabled());
  }