use of org.eclipse.scout.rt.shared.data.basic.FontSpec in project scout.rt by eclipse.
the class AbstractColumnTest method testMapEditorFieldProperties.
/**
* Tests that column properties are mapped correctly to editor field. {@link #mapEditorFieldProperties(IFormField)}
*/
@Test
public void testMapEditorFieldProperties() {
String bColor = "469406";
setBackgroundColor(bColor);
String fColor = "FAAAF1";
setForegroundColor(fColor);
FontSpec fontSpec = new FontSpec("Arial", FontSpec.STYLE_ITALIC | FontSpec.STYLE_BOLD, 0);
setFont(fontSpec);
setMandatory(true);
AbstractValueField<String> field = new AbstractValueField<String>() {
};
mapEditorFieldProperties(field);
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());
assertTrue("expected mandatory property to be progagated to field", field.isMandatory());
}
use of org.eclipse.scout.rt.shared.data.basic.FontSpec in project scout.rt by eclipse.
the class TableTest method testAddRowPreservesProperties.
@Test
public void testAddRowPreservesProperties() {
P_Table table = new P_Table();
ColumnSet cols = table.getColumnSet();
ITableRow row = new TableRow(cols);
final ITableRow insertedRow = table.addRow(row, true);
assertEquals(false, insertedRow.isChecked());
assertEquals(null, insertedRow.getCssClass());
assertEquals(null, insertedRow.getIconId());
row = new TableRow(cols);
row.setChecked(true);
row.setCssClass("abc");
FontSpec fontSpec = new FontSpec("Arial", 0, 24);
row.setFont(fontSpec);
row.setIconId("iconId");
row.setBackgroundColor("AAAAAA");
row.setForegroundColor("000000");
final ITableRow insertedRow2 = table.addRow(row, true);
assertEquals(true, insertedRow2.isChecked());
assertEquals("abc", insertedRow2.getCssClass());
assertEquals(fontSpec, insertedRow2.getCell(0).getFont());
assertEquals("iconId", insertedRow2.getIconId());
assertEquals("AAAAAA", insertedRow2.getCell(0).getBackgroundColor());
assertEquals("000000", insertedRow2.getCell(0).getForegroundColor());
}
use of org.eclipse.scout.rt.shared.data.basic.FontSpec 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.shared.data.basic.FontSpec in project scout.rt by eclipse.
the class AbstractTreeTest method testNodeChangedBatchEvents.
@Test
public void testNodeChangedBatchEvents() {
try {
m_node1.getTree().setTreeChanging(true);
m_node1.getCellForUpdate().setText("foo");
// expected no notification after setting same value again
m_node1.getCellForUpdate().setText("foo");
m_node1.getCellForUpdate().setText("foo2");
// <-- must NOT be coalesced (different node)
m_node2.getCellForUpdate().setText("foo2");
m_node1.getCellForUpdate().setBackgroundColor("FFFF00");
m_node1.getCellForUpdate().setForegroundColor("00FF00");
m_node1.getCellForUpdate().setFont(new FontSpec("Arial", FontSpec.STYLE_BOLD, 7));
// <-- all other fire NODE_CHANGED event, this fires NODES_UPDATED event
m_node1.setEnabled(false);
assertNotifications(0, 0);
} finally {
m_node1.getTree().setTreeChanging(false);
}
// custom check "assertNotification(1, 3)" because different nodes are involved
assertEquals("wrong number of notifications", 3, m_treeListener.m_notificationCounter);
assertEquals("wrong number of events", 3, m_treeListener.m_treeEvents.size());
for (int i = 0; i < m_treeListener.m_treeEvents.size(); i++) {
TreeEvent e = m_treeListener.m_treeEvents.get(i);
if (i == 1) {
Assert.assertSame("expected node to be included in tree event", m_node2, e.getNode());
} else {
Assert.assertSame("expected node to be included in tree event", m_node1, e.getNode());
}
}
}
use of org.eclipse.scout.rt.shared.data.basic.FontSpec in project scout.rt by eclipse.
the class AbstractTreeTest method testNodeChangedSingleEvents.
@Test
public void testNodeChangedSingleEvents() {
m_node1.getCellForUpdate().setText("foo");
assertNotifications(1, 1);
// expected no notification after setting same value again
m_node1.getCellForUpdate().setText("foo");
assertNotifications(1, 1);
m_node1.getCellForUpdate().setText("foo2");
assertNotifications(2, 2);
m_node1.getCellForUpdate().setBackgroundColor("FFFF00");
m_node1.getCellForUpdate().setForegroundColor("00FF00");
m_node1.getCellForUpdate().setFont(new FontSpec("Arial", FontSpec.STYLE_BOLD, 7));
assertNotifications(5, 5);
}
Aggregations