Search in sources :

Example 1 with AbstractIntegerField

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());
}
Also used : AbstractIntegerField(org.eclipse.scout.rt.client.ui.form.fields.integerfield.AbstractIntegerField) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) FontSpec(org.eclipse.scout.rt.shared.data.basic.FontSpec) Test(org.junit.Test)

Example 2 with AbstractIntegerField

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()));
}
Also used : IIntegerField(org.eclipse.scout.rt.client.ui.form.fields.integerfield.IIntegerField) AbstractIntegerField(org.eclipse.scout.rt.client.ui.form.fields.integerfield.AbstractIntegerField) ICell(org.eclipse.scout.rt.client.ui.basic.cell.ICell) Test(org.junit.Test)

Aggregations

AbstractIntegerField (org.eclipse.scout.rt.client.ui.form.fields.integerfield.AbstractIntegerField)2 Test (org.junit.Test)2 ICell (org.eclipse.scout.rt.client.ui.basic.cell.ICell)1 ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)1 IIntegerField (org.eclipse.scout.rt.client.ui.form.fields.integerfield.IIntegerField)1 FontSpec (org.eclipse.scout.rt.shared.data.basic.FontSpec)1