use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture in project nebula.widgets.nattable by eclipse.
the class ReorderColumnEventTest method reorderEventMustPropagateToTheTop.
/**
* Fix for http://nattable.org/jira/browse/NTBL-476
*/
@Test
public void reorderEventMustPropagateToTheTop() throws Exception {
DefaultBodyLayerStack underlyingLayer = new DefaultBodyLayerStack(new DataLayerFixture(20, 10, 100, 20));
NatTableFixture natTableFixture = new NatTableFixture(underlyingLayer);
// Add listener
LayerListenerFixture listenerFixture = new LayerListenerFixture();
natTableFixture.addLayerListener(listenerFixture);
assertEquals(6, natTableFixture.getColumnCount());
assertEquals(1, natTableFixture.getColumnIndexByPosition(1));
// Move to outside the visible range
List<Integer> columnToMove = Arrays.asList(1, 2, 3);
int destinationPosition = 10;
natTableFixture.doCommand(new MultiColumnReorderCommand(natTableFixture, columnToMove, destinationPosition));
// Ensure that the event propagates to the top
assertEquals(1, listenerFixture.getEventsCount());
assertNotNull(listenerFixture.getReceivedEvent(ColumnReorderEvent.class));
assertEquals(4, natTableFixture.getColumnIndexByPosition(1));
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture in project nebula.widgets.nattable by eclipse.
the class ReorderRowEventTest method reorderEventMustPropagateToTheTop.
@Test
public void reorderEventMustPropagateToTheTop() throws Exception {
DefaultBodyLayerStack underlyingLayer = new DefaultBodyLayerStack(new RowReorderLayer(new DataLayerFixture(10, 10, 100, 20)));
NatTableFixture natTableFixture = new NatTableFixture(underlyingLayer);
// Add listener
LayerListenerFixture listenerFixture = new LayerListenerFixture();
natTableFixture.addLayerListener(listenerFixture);
Assert.assertEquals(10, natTableFixture.getRowCount());
Assert.assertEquals(1, natTableFixture.getRowIndexByPosition(1));
// Move to outside the visible range
List<Integer> rowsToMove = Arrays.asList(1, 2, 3);
int destinationPosition = 10;
natTableFixture.doCommand(new MultiRowReorderCommand(natTableFixture, rowsToMove, destinationPosition));
// Ensure that the event propagates to the top
Assert.assertEquals(1, listenerFixture.getEventsCount());
Assert.assertNotNull(listenerFixture.getReceivedEvent(RowReorderEvent.class));
Assert.assertEquals(4, natTableFixture.getRowIndexByPosition(1));
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture in project nebula.widgets.nattable by eclipse.
the class MultiRowResizeCommandTest method testGetCommonColumnWidth.
@Test
public void testGetCommonColumnWidth() {
MultiRowResizeCommand resizeCommand = new MultiRowResizeCommand(new DataLayerFixture(), new int[] { 1, 2 }, 100);
assertEquals(100, resizeCommand.getCommonRowHeight());
assertEquals(100, resizeCommand.getRowHeight(1));
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture in project nebula.widgets.nattable by eclipse.
the class MultiRowResizeCommandTest method testGetRowHeight.
@Test
public void testGetRowHeight() {
MultiRowResizeCommand resizeCommand = new MultiRowResizeCommand(new DataLayerFixture(), new int[] { 5, 9 }, new int[] { 12, 20 });
assertEquals(12, resizeCommand.getRowHeight(5));
assertEquals(20, resizeCommand.getRowHeight(9));
// Error case
assertEquals(-1, resizeCommand.getRowHeight(10));
assertEquals(-1, resizeCommand.getCommonRowHeight());
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture in project nebula.widgets.nattable by eclipse.
the class ColumnGroupUtilsTest method setup.
/*
* Test fixture
*
* 0 1 2 3 4 5 6 ... 8 9 10 11 12
* ------------------------------------------------------------------ |<- G1
* ->| |<-- G2 -->| |<- G4 ->|<--- G3 --->|
*/
@Before
public void setup() {
this.model = new ColumnGroupModelFixture();
this.model.addColumnsIndexesToGroup("G4", 8, 9);
this.bodyStack = new ColumnGroupBodyLayerStack(new DataLayerFixture(20, 10, 10, 20), this.model);
// Inits client area
new NatTableFixture(this.bodyStack);
}
Aggregations