use of org.eclipse.scout.rt.client.ui.form.fields.sequencebox.InvalidSequenceStatus in project scout.rt by eclipse.
the class FormFieldTest method testRemoveWithRemainingErrorStatus.
@Test
public void testRemoveWithRemainingErrorStatus() throws Exception {
SimpleTestFormField testField = new SimpleTestFormField();
P_PropertyChangeEventCounter counter = new P_PropertyChangeEventCounter();
testField.addPropertyChangeListener(IFormField.PROP_ERROR_STATUS, counter);
IMultiStatus status0 = testField.getErrorStatus();
testField.addErrorStatus(new InvalidSequenceStatus("error"));
assertTrue(testField.getErrorStatus().containsStatus(InvalidSequenceStatus.class));
assertFalse(testField.getErrorStatus().containsStatus(ParsingFailedStatus.class));
IMultiStatus status1 = testField.getErrorStatus();
testField.addErrorStatus(new ParsingFailedStatus("error", "input"));
assertTrue(testField.getErrorStatus().containsStatus(InvalidSequenceStatus.class));
assertTrue(testField.getErrorStatus().containsStatus(ParsingFailedStatus.class));
IMultiStatus status2 = testField.getErrorStatus();
testField.removeErrorStatus(ParsingFailedStatus.class);
assertTrue(testField.getErrorStatus().containsStatus(InvalidSequenceStatus.class));
assertFalse(testField.getErrorStatus().containsStatus(ParsingFailedStatus.class));
IMultiStatus status3 = testField.getErrorStatus();
assertNotEquals(status0, status1);
assertNotEquals(status1, status2);
assertNotEquals(status2, status3);
// add + add + remove
assertEquals(3, counter.getCount());
}
use of org.eclipse.scout.rt.client.ui.form.fields.sequencebox.InvalidSequenceStatus in project scout.rt by eclipse.
the class FormFieldTest method testAddMultipleRemoveOneAddErrorStatus.
@Test
public void testAddMultipleRemoveOneAddErrorStatus() throws Exception {
SimpleTestFormField testField = new SimpleTestFormField();
P_PropertyChangeEventCounter counter = new P_PropertyChangeEventCounter();
testField.addPropertyChangeListener(IFormField.PROP_ERROR_STATUS, counter);
IMultiStatus status0 = testField.getErrorStatus();
testField.addErrorStatus(new InvalidSequenceStatus("error"));
assertTrue(testField.getErrorStatus().containsStatus(InvalidSequenceStatus.class));
assertFalse(testField.getErrorStatus().containsStatus(ParsingFailedStatus.class));
IMultiStatus status1 = testField.getErrorStatus();
testField.addErrorStatus(new ParsingFailedStatus("error", "input"));
assertTrue(testField.getErrorStatus().containsStatus(InvalidSequenceStatus.class));
assertTrue(testField.getErrorStatus().containsStatus(ParsingFailedStatus.class));
IMultiStatus status2 = testField.getErrorStatus();
testField.removeErrorStatus(ParsingFailedStatus.class);
assertTrue(testField.getErrorStatus().containsStatus(InvalidSequenceStatus.class));
assertFalse(testField.getErrorStatus().containsStatus(ParsingFailedStatus.class));
IMultiStatus status3 = testField.getErrorStatus();
testField.addErrorStatus(new ParsingFailedStatus("error", "input"));
assertTrue(testField.getErrorStatus().containsStatus(InvalidSequenceStatus.class));
assertTrue(testField.getErrorStatus().containsStatus(ParsingFailedStatus.class));
IMultiStatus status4 = testField.getErrorStatus();
assertNotEquals(status0, status1);
assertNotEquals(status1, status2);
assertNotEquals(status2, status3);
assertNotEquals(status3, status4);
// add + add + remove + add
assertEquals(4, counter.getCount());
}
use of org.eclipse.scout.rt.client.ui.form.fields.sequencebox.InvalidSequenceStatus in project scout.rt by eclipse.
the class FormFieldTest method testRemoveNonExistingErrorStatus.
@Test
public void testRemoveNonExistingErrorStatus() throws Exception {
SimpleTestFormField testField = new SimpleTestFormField();
P_PropertyChangeEventCounter counter = new P_PropertyChangeEventCounter();
testField.addPropertyChangeListener(IFormField.PROP_ERROR_STATUS, counter);
IMultiStatus status0 = testField.getErrorStatus();
testField.addErrorStatus(new InvalidSequenceStatus("error"));
assertTrue(testField.getErrorStatus().containsStatus(InvalidSequenceStatus.class));
assertFalse(testField.getErrorStatus().containsStatus(ParsingFailedStatus.class));
IMultiStatus status1 = testField.getErrorStatus();
// should not trigger an event
testField.removeErrorStatus(ParsingFailedStatus.class);
assertTrue(testField.getErrorStatus().containsStatus(InvalidSequenceStatus.class));
assertFalse(testField.getErrorStatus().containsStatus(ParsingFailedStatus.class));
IMultiStatus status2 = testField.getErrorStatus();
assertNotEquals(status0, status1);
assertEquals(status1, status2);
assertEquals(1, counter.getCount());
}
Aggregations