Search in sources :

Example 46 with DataLayerFixture

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

the class RowReorderLayerTest method commandPassedOnToParentIfCannotBeHandled.

@Test
public void commandPassedOnToParentIfCannotBeHandled() throws Exception {
    RowReorderLayer reorderLayer = new RowReorderLayer(new DataLayerFixture());
    assertFalse(reorderLayer.doCommand(new LayerCommandFixture()));
}
Also used : LayerCommandFixture(org.eclipse.nebula.widgets.nattable.test.fixture.command.LayerCommandFixture) DataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture) BaseDataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.BaseDataLayerFixture) Test(org.junit.Test)

Example 47 with DataLayerFixture

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

the class RowReorderLayerTest method canHandleRowReorderCommand.

@Test
public void canHandleRowReorderCommand() throws Exception {
    RowReorderLayer reorderLayer = new RowReorderLayer(new DataLayerFixture());
    RowReorderCommand reorderCommand = new RowReorderCommand(reorderLayer, 0, 2);
    assertTrue(reorderLayer.doCommand(reorderCommand));
}
Also used : DataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture) BaseDataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.BaseDataLayerFixture) RowReorderCommand(org.eclipse.nebula.widgets.nattable.reorder.command.RowReorderCommand) Test(org.junit.Test)

Example 48 with DataLayerFixture

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

the class RowReorderLayerTest method getStartYForReorderedRow.

@Test
public void getStartYForReorderedRow() throws Exception {
    this.underlyingLayer = new DataLayerFixture();
    this.rowReorderLayer = new RowReorderLayer(this.underlyingLayer);
    // 0 1 2 3 4 - see DataLayerFixture
    this.rowReorderLayer.reorderRowPosition(0, 5);
    // Index: 1 2 3 4 0 Height: 70 25 40 50 40 100 40
    assertEquals(0, this.rowReorderLayer.getStartYOfRowPosition(0));
    assertEquals(70, this.rowReorderLayer.getStartYOfRowPosition(1));
    assertEquals(95, this.rowReorderLayer.getStartYOfRowPosition(2));
    assertEquals(135, this.rowReorderLayer.getStartYOfRowPosition(3));
    assertEquals(185, this.rowReorderLayer.getStartYOfRowPosition(4));
    assertEquals(225, this.rowReorderLayer.getStartYOfRowPosition(5));
    assertEquals(265, this.rowReorderLayer.getStartYOfRowPosition(6));
}
Also used : DataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture) BaseDataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.BaseDataLayerFixture) Test(org.junit.Test)

Example 49 with DataLayerFixture

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

the class RowHideShowLayerTest method showRowPositions.

@Test
public void showRowPositions() throws Exception {
    this.rowHideShowLayer = new RowHideShowLayerFixture(new DataLayerFixture(2, 10, 100, 20));
    assertEquals(10, this.rowHideShowLayer.getRowCount());
    this.rowHideShowLayer.hideRowPositions(Arrays.asList(3, 4, 5));
    assertEquals(7, this.rowHideShowLayer.getRowCount());
    assertEquals(-1, this.rowHideShowLayer.getRowPositionByIndex(3));
    assertEquals(-1, this.rowHideShowLayer.getRowPositionByIndex(4));
    this.rowHideShowLayer.showRowIndexes(Arrays.asList(3, 4));
    assertEquals(9, this.rowHideShowLayer.getRowCount());
    assertEquals(3, this.rowHideShowLayer.getRowPositionByIndex(3));
    assertEquals(4, this.rowHideShowLayer.getRowPositionByIndex(4));
}
Also used : RowHideShowLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.RowHideShowLayerFixture) DataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture) Test(org.junit.Test)

Example 50 with DataLayerFixture

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

the class HideShowRowEventTest method setUp.

@Before
public void setUp() {
    this.hideShowLayer = new BaseRowHideShowLayerFixture(new DataLayerFixture(100, 40));
    this.layerListener = new LayerListenerFixture();
}
Also used : BaseRowHideShowLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.BaseRowHideShowLayerFixture) DataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture) LayerListenerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture) Before(org.junit.Before)

Aggregations

DataLayerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture)57 Test (org.junit.Test)28 Before (org.junit.Before)27 BaseDataLayerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.BaseDataLayerFixture)11 LayerListenerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture)7 Rectangle (org.eclipse.swt.graphics.Rectangle)7 DefaultBodyLayerStack (org.eclipse.nebula.widgets.nattable.layer.stack.DefaultBodyLayerStack)6 ViewportLayer (org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer)6 NatTableFixture (org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture)5 IClientAreaProvider (org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider)5 SelectionLayer (org.eclipse.nebula.widgets.nattable.selection.SelectionLayer)4 ColumnOverrideLabelAccumulator (org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator)3 LayerCommandFixture (org.eclipse.nebula.widgets.nattable.test.fixture.command.LayerCommandFixture)3 ColumnGroupModelFixture (org.eclipse.nebula.widgets.nattable.test.fixture.group.ColumnGroupModelFixture)3 Properties (java.util.Properties)2 IConfigRegistry (org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)2 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)2 RowDataFixture (org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture)2 ColumnHideShowLayer (org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer)2 RowHideShowLayer (org.eclipse.nebula.widgets.nattable.hideshow.RowHideShowLayer)2