Search in sources :

Example 6 with NatTableFixture

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

the class ConfigurableCellBorderTest method setUp.

@Before
public void setUp() throws Exception {
    this.natTable = new NatTableFixture();
    this.configRegistry = (ConfigRegistry) this.natTable.getConfigRegistry();
}
Also used : NatTableFixture(org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture) Before(org.junit.Before)

Example 7 with NatTableFixture

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

the class TextRenderingTest method setUp.

@Before
public void setUp() throws Exception {
    this.natTable = new NatTableFixture();
    this.configRegistry = (ConfigRegistry) this.natTable.getConfigRegistry();
    this.cellPainter = new TextPainter();
    this.gc = new GC(Display.getDefault());
}
Also used : NatTableFixture(org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture) GC(org.eclipse.swt.graphics.GC) Before(org.junit.Before)

Example 8 with NatTableFixture

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

the class PersistenceHelperTest method testDeleteState.

@Test
public void testDeleteState() {
    Properties properties = new Properties();
    NatTable natTable = new NatTableFixture();
    natTable.saveState("", properties);
    natTable.saveState("Blubb", properties);
    natTable.saveState("Temp", properties);
    Collection<String> stateNames = PersistenceHelper.getAvailableStates(properties);
    assertTrue("Resulting state name collection does not contain the empty default state", stateNames.contains(""));
    assertTrue("Resulting state name collection does not contain the 'Blubb' state", stateNames.contains("Blubb"));
    assertTrue("Resulting state name collection does not contain the 'Temp' state", stateNames.contains("Temp"));
    PersistenceHelper.deleteState("Blubb", properties);
    stateNames = PersistenceHelper.getAvailableStates(properties);
    assertTrue("Resulting state name collection does not contain the empty default state", stateNames.contains(""));
    assertFalse("Resulting state name collection does not contain the 'Blubb' state", stateNames.contains("Blubb"));
    assertTrue("Resulting state name collection does not contain the 'Temp' state", stateNames.contains("Temp"));
}
Also used : NatTableFixture(org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture) NatTable(org.eclipse.nebula.widgets.nattable.NatTable) Properties(java.util.Properties) Test(org.junit.Test)

Example 9 with NatTableFixture

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

the class PersistenceHelperTest method testDeleteStateOnEmptyState.

@Test
public void testDeleteStateOnEmptyState() {
    Properties properties = new Properties();
    NatTable natTable = new NatTableFixture();
    natTable.saveState("", properties);
    natTable.saveState("Blubb", properties);
    natTable.saveState("Temp", properties);
    Collection<String> stateNames = PersistenceHelper.getAvailableStates(properties);
    assertTrue("Resulting state name collection does not contain the empty default state", stateNames.contains(""));
    assertTrue("Resulting state name collection does not contain the 'Blubb' state", stateNames.contains("Blubb"));
    assertTrue("Resulting state name collection does not contain the 'Temp' state", stateNames.contains("Temp"));
    PersistenceHelper.deleteState("", properties);
    // no impact
    stateNames = PersistenceHelper.getAvailableStates(properties);
    assertFalse("Resulting state name collection does not contain the empty default state", stateNames.contains(""));
    assertTrue("Resulting state name collection does not contain the 'Blubb' state", stateNames.contains("Blubb"));
    assertTrue("Resulting state name collection does not contain the 'Temp' state", stateNames.contains("Temp"));
}
Also used : NatTableFixture(org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture) NatTable(org.eclipse.nebula.widgets.nattable.NatTable) Properties(java.util.Properties) Test(org.junit.Test)

Example 10 with NatTableFixture

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

the class PersistenceHelperTest method testDeleteStateOnEmptyProperties.

@Test
public void testDeleteStateOnEmptyProperties() {
    Properties properties = new Properties();
    NatTable natTable = new NatTableFixture();
    natTable.saveState("", properties);
    natTable.saveState("Blubb", properties);
    natTable.saveState("Temp", properties);
    Collection<String> stateNames = PersistenceHelper.getAvailableStates(properties);
    assertTrue("Resulting state name collection does not contain the empty default state", stateNames.contains(""));
    assertTrue("Resulting state name collection does not contain the 'Blubb' state", stateNames.contains("Blubb"));
    assertTrue("Resulting state name collection does not contain the 'Temp' state", stateNames.contains("Temp"));
    PersistenceHelper.deleteState("Blubb", new Properties());
    // no impact
    stateNames = PersistenceHelper.getAvailableStates(properties);
    assertTrue("Resulting state name collection does not contain the empty default state", stateNames.contains(""));
    assertTrue("Resulting state name collection does not contain the 'Blubb' state", stateNames.contains("Blubb"));
    assertTrue("Resulting state name collection does not contain the 'Temp' state", stateNames.contains("Temp"));
}
Also used : NatTableFixture(org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture) NatTable(org.eclipse.nebula.widgets.nattable.NatTable) Properties(java.util.Properties) Test(org.junit.Test)

Aggregations

NatTableFixture (org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture)51 Test (org.junit.Test)29 Before (org.junit.Before)22 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)16 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)13 DummyGridLayerStack (org.eclipse.nebula.widgets.nattable.layer.stack.DummyGridLayerStack)13 LayerListenerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture)11 RowDataFixture (org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture)8 Properties (java.util.Properties)7 Range (org.eclipse.nebula.widgets.nattable.coordinate.Range)7 GridLayerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture)6 ListDataProvider (org.eclipse.nebula.widgets.nattable.data.ListDataProvider)5 SpanningDataLayer (org.eclipse.nebula.widgets.nattable.layer.SpanningDataLayer)5 DataLayerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture)5 ViewportLayer (org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer)5 IRowIdAccessor (org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor)4 DefaultEditBindings (org.eclipse.nebula.widgets.nattable.edit.config.DefaultEditBindings)4 DefaultEditConfiguration (org.eclipse.nebula.widgets.nattable.edit.config.DefaultEditConfiguration)4 IUniqueIndexLayer (org.eclipse.nebula.widgets.nattable.layer.IUniqueIndexLayer)4 SelectionLayer (org.eclipse.nebula.widgets.nattable.selection.SelectionLayer)4