use of org.eclipse.scout.rt.client.ui.form.fields.integerfield.AbstractIntegerField in project scout.rt by eclipse.
the class AbstractNumberColumnTest method testPrepareEditInternal.
@Test
public void testPrepareEditInternal() {
setGroupingUsed(false);
String bColor = "469406";
setBackgroundColor(bColor);
String fColor = "FAAAF1";
setForegroundColor(fColor);
FontSpec fontSpec = new FontSpec("Arial", FontSpec.STYLE_ITALIC | FontSpec.STYLE_BOLD, 0);
setFont(fontSpec);
Integer minValue = Integer.valueOf(-42);
setMinValue(minValue);
Integer maxValue = Integer.valueOf(42);
setMaxValue(maxValue);
ITableRow row = Mockito.mock(ITableRow.class);
AbstractIntegerField field = (AbstractIntegerField) prepareEditInternal(row);
assertFalse("expected groupingUsed property to be propagated to field", field.isGroupingUsed());
setGroupingUsed(true);
field = (AbstractIntegerField) prepareEditInternal(row);
assertTrue("expected groupingUsed property to be propagated to field", field.isGroupingUsed());
assertEquals("expected backgroundColor property to be progagated to field", bColor, field.getBackgroundColor());
assertEquals("expected foregroundColor property to be progagated to field", fColor, field.getForegroundColor());
assertEquals("expected font property to be progagated to field", fontSpec, field.getFont());
assertEquals("expected minValue property to be progagated to field", minValue, field.getMinValue());
assertEquals("expected maxValue property to be progagated to field", maxValue, field.getMaxValue());
}
use of org.eclipse.scout.rt.client.ui.form.fields.integerfield.AbstractIntegerField in project scout.rt by eclipse.
the class AbstractColumnTest method testCompleteEdit_ParsingError.
@Test
public void testCompleteEdit_ParsingError() {
ParsingTestTable table = new ParsingTestTable();
table.addRowsByArray(new Integer[] { 0 });
IIntegerField field = new AbstractIntegerField() {
};
field.parseAndSetValue("invalid number");
table.getIntTestColumn().completeEdit(table.getRow(0), field);
ICell c = table.getCell(0, 0);
assertEquals("invalid number", c.getText());
assertEquals(0, c.getValue());
assertNotNull(String.format("The invalid cell should have an error status: value '%s'", c.getValue(), c.getErrorStatus()));
}
Aggregations