Search in sources :

Example 1 with PropertiesFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.PropertiesFixture in project nebula.widgets.nattable by eclipse.

the class AbstractLayerTest method persistablesAreSaved.

@Test
public void persistablesAreSaved() throws Exception {
    PersistableFixture persistable = new PersistableFixture();
    PropertiesFixture properties = new PropertiesFixture();
    this.dataLayer.registerPersistable(persistable);
    this.dataLayer.saveState("test_prefix", properties);
    Assert.assertTrue(persistable.stateSaved);
}
Also used : PropertiesFixture(org.eclipse.nebula.widgets.nattable.test.fixture.PropertiesFixture) PersistableFixture(org.eclipse.nebula.widgets.nattable.test.fixture.PersistableFixture) Test(org.junit.Test)

Example 2 with PropertiesFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.PropertiesFixture 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"));
}
Also used : CellStyleFixture(org.eclipse.nebula.widgets.nattable.test.fixture.CellStyleFixture) PropertiesFixture(org.eclipse.nebula.widgets.nattable.test.fixture.PropertiesFixture) Test(org.junit.Test)

Example 3 with PropertiesFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.PropertiesFixture in project nebula.widgets.nattable by eclipse.

the class DisplayColumnStyleEditorCommandHandlerTest method loadStateForMultipleLabels.

@Test
public void loadStateForMultipleLabels() throws Exception {
    PropertiesFixture propertiesFixture = new PropertiesFixture().addStyleProperties("prefix.userDefinedColumnStyle.USER_EDITED_STYLE_FOR_INDEX_0").addStyleProperties("prefix.userDefinedColumnStyle.USER_EDITED_STYLE_FOR_INDEX_1");
    this.handlerUnderTest.loadState("prefix", propertiesFixture);
    Style style = (Style) this.configRegistryFixture.getConfigAttribute(CellConfigAttributes.CELL_STYLE, DisplayMode.NORMAL, "USER_EDITED_STYLE_FOR_INDEX_0");
    assertEquals(HorizontalAlignmentEnum.LEFT, style.getAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT));
    style = (Style) this.configRegistryFixture.getConfigAttribute(CellConfigAttributes.CELL_STYLE, DisplayMode.NORMAL, "USER_EDITED_STYLE_FOR_INDEX_1");
    assertEquals(VerticalAlignmentEnum.TOP, style.getAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT));
}
Also used : Style(org.eclipse.nebula.widgets.nattable.style.Style) PropertiesFixture(org.eclipse.nebula.widgets.nattable.test.fixture.PropertiesFixture) Test(org.junit.Test)

Example 4 with PropertiesFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.PropertiesFixture in project nebula.widgets.nattable by eclipse.

the class DisplayColumnStyleEditorCommandHandlerTest method loadStateForMultipleMixedLabels.

@Test
public void loadStateForMultipleMixedLabels() throws Exception {
    PropertiesFixture propertiesFixture = new PropertiesFixture().addStyleProperties("prefix.userDefinedColumnStyle.USER_EDITED_STYLE_FOR_INDEX_0").addStyleProperties("prefix.userDefinedColumnStyle.USER_EDITED_STYLE_FOR_INDEX_1").addStyleProperties("prefix.userDefinedColumnStyle.USER_EDITED_STYLE");
    this.handlerUnderTest.loadState("prefix", propertiesFixture);
    Style style = (Style) this.configRegistryFixture.getConfigAttribute(CellConfigAttributes.CELL_STYLE, DisplayMode.NORMAL, "USER_EDITED_STYLE_FOR_INDEX_0");
    assertEquals(HorizontalAlignmentEnum.LEFT, style.getAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT));
    style = (Style) this.configRegistryFixture.getConfigAttribute(CellConfigAttributes.CELL_STYLE, DisplayMode.NORMAL, "USER_EDITED_STYLE_FOR_INDEX_1");
    assertEquals(VerticalAlignmentEnum.TOP, style.getAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT));
    style = (Style) this.configRegistryFixture.getConfigAttribute(CellConfigAttributes.CELL_STYLE, DisplayMode.NORMAL, "USER_EDITED_STYLE");
    assertEquals(VerticalAlignmentEnum.TOP, style.getAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT));
}
Also used : Style(org.eclipse.nebula.widgets.nattable.style.Style) PropertiesFixture(org.eclipse.nebula.widgets.nattable.test.fixture.PropertiesFixture) Test(org.junit.Test)

Aggregations

PropertiesFixture (org.eclipse.nebula.widgets.nattable.test.fixture.PropertiesFixture)4 Test (org.junit.Test)4 Style (org.eclipse.nebula.widgets.nattable.style.Style)2 CellStyleFixture (org.eclipse.nebula.widgets.nattable.test.fixture.CellStyleFixture)1 PersistableFixture (org.eclipse.nebula.widgets.nattable.test.fixture.PersistableFixture)1