public void testUnknowParams() throws Exception {
    Window uispecDialog = createUISpecWindow(JOB_WITH_UNKNOWN_PARAMS);

    TextBox runTextBox = uispecDialog.getTextBox(ComponentMatchers.componentLabelFor("run"));
    assertTrue(runTextBox.textEquals("Unkown parameter"));
    assertTrue(runTextBox.iconEquals(GuiUtil.loadIcon("error.png")));

    assertFalse(uispecDialog.getButton("OK").isEnabled());
  }
  public void testUnsupportedParams() throws Exception {
    Window uispecDialog = createUISpecWindow(JOB_WITH_UNSUPPORTED_PARAMS);

    TextBox runTextBox = uispecDialog.getTextBox(ComponentMatchers.componentLabelFor("run"));
    assertTrue(runTextBox.textEquals("RunParameterDefinition is unsupported."));
    assertTrue(runTextBox.iconEquals(GuiUtil.loadIcon("error.png")));

    assertFalse(uispecDialog.getButton("OK").isEnabled());
  }
예제 #3
0
  public void test_undoRedoSnapshotMode() throws Exception {
    DetailDataSource dataSource = new DetailDataSource(new MadGuiContext());

    final JCheckBox checkBox = new JCheckBox();
    final JTextField textField = new JTextField();
    final NoNullDateField dateField = new NoNullDateField();
    dateFieldWrapper = new Panel(dateField);
    textFieldWrapper = new TextBox(textField);
    checkBoxWrapper = new CheckBox(checkBox);

    dataSource.declare("checkbox", checkBox);
    dataSource.declare("textfield", textField);
    dataSource.declare("date", dateField);

    buttonPanelLogic.setMainDataSource(dataSource);

    checkBox.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent event) {
            if (checkBox.isSelected()) {
              buttonPanelLogic.startSnapshotMode();
              textField.setText("OK");
              dateField.setDate(java.sql.Date.valueOf("2007-08-24"));
              buttonPanelLogic.stopSnapshotMode();
            }
          }
        });

    assertGuiComponents(false, "", "");

    checkBoxWrapper.click();
    Thread.sleep(200);
    assertGuiComponents(true, "OK", "24-08-2007");

    textFieldWrapper.pressKey(Key.N);
    assertGuiComponents(true, "NOK", "24-08-2007");

    dateField.setDate(java.sql.Date.valueOf("2007-08-30"));
    assertGuiComponents(true, "NOK", "30-08-2007");

    undo();
    assertGuiComponents(true, "NOK", "24-08-2007");

    undo();
    assertGuiComponents(true, "OK", "24-08-2007");

    undo();
    assertGuiComponents(false, "", "");

    redo();
    assertGuiComponents(true, "OK", "24-08-2007");

    redo();
    assertGuiComponents(true, "NOK", "24-08-2007");

    redo();
    assertGuiComponents(true, "NOK", "30-08-2007");
  }
예제 #4
0
 private void assertGuiComponents(
     boolean expectedCheckBox, String expectedText, String expectedDate) {
   assertEquals(expectedCheckBox, checkBoxWrapper.isSelected());
   assertTrue(textFieldWrapper.textEquals(expectedText));
   assertDateField(expectedDate);
 }