use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.BaseDataLayerFixture in project nebula.widgets.nattable by eclipse.
the class RowReorderLayerVisibleChangeTest method returnsCorrectPositionRectangleForMultiColumnReorderRightCase.
@SuppressWarnings("boxing")
@Test
public /**
* Index 2 3 0 1 ... 20
* --------------------
* Position 0 1 2 3 ... 20
*/
void returnsCorrectPositionRectangleForMultiColumnReorderRightCase() {
RowReorderLayer reorderLayer = new RowReorderLayer(new BaseDataLayerFixture(20, 20));
// Build expected cell positions to redraw
final Set<Rectangle> expectedPositions = new HashSet<Rectangle>();
expectedPositions.add(new Rectangle(0, 0, 20, 20));
reorderLayer.addLayerListener(new ILayerListener() {
@Override
public void handleLayerEvent(ILayerEvent event) {
RowReorderEvent multiReorder = (RowReorderEvent) event;
assertTrue(multiReorder.getChangedPositionRectangles().containsAll(expectedPositions));
}
});
// Reorder from beginning of grid
List<Integer> fromRowPositions = Arrays.asList(new Integer[] { 0, 1 });
reorderLayer.reorderMultipleRowPositions(fromRowPositions, 2);
// Reorder to middle of grid
expectedPositions.clear();
expectedPositions.add(new Rectangle(0, 5, 20, 15));
fromRowPositions = Arrays.asList(new Integer[] { 5, 6, 7, 8 });
reorderLayer.reorderMultipleRowPositions(fromRowPositions, 10);
// Reorder to end of grid
expectedPositions.clear();
expectedPositions.add(new Rectangle(0, 10, 20, 10));
fromRowPositions = Arrays.asList(new Integer[] { 10, 11, 12, 13 });
reorderLayer.reorderMultipleRowPositions(fromRowPositions, 19);
}
Aggregations