use of org.eclipse.nebula.widgets.nattable.test.fixture.CellStyleFixture in project nebula.widgets.nattable by eclipse.
the class StylePersistorTest method persistStyleSettingsToProperties.
@Test
public void persistStyleSettingsToProperties() throws Exception {
Properties properties = new Properties();
StylePersistor.saveStyle(TEST_PREFIX, properties, new CellStyleFixture());
String expectedPrefix = TEST_PREFIX + DOT + STYLE_PERSISTENCE_PREFIX + DOT;
assertEquals("255,255,255", properties.getProperty(expectedPrefix + BG_COLOR_PREFIX + DOT + ColorPersistor.STYLE_PERSISTENCE_PREFIX));
assertEquals("0,0,0", properties.getProperty(expectedPrefix + FG_COLOR_PREFIX + DOT + ColorPersistor.STYLE_PERSISTENCE_PREFIX));
assertEquals("LEFT", properties.getProperty(expectedPrefix + H_ALIGNMENT_PREFIX));
assertEquals("MIDDLE", properties.getProperty(expectedPrefix + V_ALIGNMENT_PREFIX));
assertEquals(CellStyleFixture.TEST_FONT.getFontData()[0].toString(), properties.getProperty(expectedPrefix + FONT_PREFIX));
assertEquals(CellStyleFixture.TEST_BORDER_STYLE.toString(), properties.getProperty(expectedPrefix + BORDER_PREFIX));
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.CellStyleFixture in project nebula.widgets.nattable by eclipse.
the class DisplayColumnStyleEditorCommandHandlerTest method saveStateForMultipleLabels.
@Test
public void saveStateForMultipleLabels() throws Exception {
CellStyleFixture style1 = new CellStyleFixture(HorizontalAlignmentEnum.LEFT);
CellStyleFixture style2 = new CellStyleFixture(HorizontalAlignmentEnum.RIGHT);
this.handlerUnderTest.stylesToPersist.put("label1", style1);
this.handlerUnderTest.stylesToPersist.put("label2", style2);
PropertiesFixture propertiesFixture = new PropertiesFixture();
this.handlerUnderTest.saveState("prefix", propertiesFixture);
assertEquals(HorizontalAlignmentEnum.LEFT.name(), propertiesFixture.getProperty("prefix.userDefinedColumnStyle.label1.style.horizontalAlignment"));
assertEquals(HorizontalAlignmentEnum.RIGHT.name(), propertiesFixture.getProperty("prefix.userDefinedColumnStyle.label2.style.horizontalAlignment"));
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.CellStyleFixture in project nebula.widgets.nattable by eclipse.
the class DisplayColumnStyleEditorCommandHandlerTest method doCommand.
@Test
public void doCommand() throws Exception {
this.handlerUnderTest.dialog = new ColumnStyleEditorDialog(new Shell(), new CellStyleFixture());
this.handlerUnderTest.applySelectedStyleToColumns(this.commandFixture, new int[] { 0 });
Style selectedStyle = (Style) this.configRegistryFixture.getConfigAttribute(CELL_STYLE, NORMAL, this.handlerUnderTest.getConfigLabel(0));
assertEquals(CellStyleFixture.TEST_BG_COLOR, selectedStyle.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR));
assertEquals(CellStyleFixture.TEST_FG_COLOR, selectedStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR));
List<String> columnLableOverrides = this.handlerUnderTest.columnLabelAccumulator.getOverrides(Integer.valueOf(0));
assertEquals(1, columnLableOverrides.size());
assertEquals(USER_EDITED_COLUMN_STYLE_LABEL_PREFIX + "0", columnLableOverrides.get(0));
}
Aggregations