Search in sources :

Example 6 with FontSpec

use of org.eclipse.scout.rt.shared.data.basic.FontSpec in project scout.rt by eclipse.

the class CellTest method testConstructor_copy.

/**
 * When a new Cell is crated as a copy <br>
 * , all values should be copied and that there are no calls to an observer
 */
@Test
public void testConstructor_copy() throws Exception {
    Object value = new Object();
    String text = "text";
    String iconId = "iconId";
    String tooltipText = "Tooltip";
    String bgColor = "eeeeee";
    String fgColor = "ff0000";
    String cssClass = "myClass";
    FontSpec font = FontSpec.parse("Arial-bold-italic-16");
    ICellObserver observer = Mockito.mock(ICellObserver.class);
    Cell c = new Cell();
    c.setValue(value);
    c.setText(text);
    c.setIconId(iconId);
    c.setTooltipText(tooltipText);
    c.setHorizontalAlignment(100);
    c.setBackgroundColor(bgColor);
    c.setForegroundColor(fgColor);
    c.setFont(font);
    c.setHtmlEnabled(true);
    c.setCssClass(cssClass);
    c.setMandatory(true);
    c.setObserver(observer);
    Cell copy = new Cell(c);
    assertSame(value, copy.getValue());
    assertEquals(text, copy.getText());
    assertEquals(iconId, copy.getIconId());
    assertEquals(tooltipText, copy.getTooltipText());
    assertEquals(cssClass, copy.getCssClass());
    assertTrue(copy.isHtmlEnabled());
    assertTrue(copy.isMandatory());
    assertEquals(100, c.getHorizontalAlignment());
    assertEquals(bgColor, c.getBackgroundColor());
    assertEquals(fgColor, c.getForegroundColor());
    assertEquals(cssClass, c.getCssClass());
    assertEquals(font.toPattern(), c.getFont().toPattern());
    assertTrue(c.isMandatory());
    assertTrue(c.isHtmlEnabled());
    assertSame(observer, c.getObserver());
    verifyZeroInteractions(observer);
}
Also used : FontSpec(org.eclipse.scout.rt.shared.data.basic.FontSpec) Test(org.junit.Test)

Example 7 with FontSpec

use of org.eclipse.scout.rt.shared.data.basic.FontSpec in project scout.rt by eclipse.

the class CellTest method testSetFont.

@Test
public void testSetFont() {
    Cell c = new Cell();
    ICellObserver observer = installMockObserver(c);
    FontSpec font = FontSpec.parse("Arial-bold-italic-13");
    c.setFont(font);
    assertEquals(font.toPattern(), c.getFont().toPattern());
    verify(observer).cellChanged(c, ICell.FONT_BIT);
}
Also used : FontSpec(org.eclipse.scout.rt.shared.data.basic.FontSpec) Test(org.junit.Test)

Aggregations

FontSpec (org.eclipse.scout.rt.shared.data.basic.FontSpec)7 Test (org.junit.Test)7 ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)1 AbstractValueField (org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField)1 AbstractIntegerField (org.eclipse.scout.rt.client.ui.form.fields.integerfield.AbstractIntegerField)1