use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnReorderLayerFixture in project nebula.widgets.nattable by eclipse.
the class MultiColumnResizeCommandTest method getColumnWidthWhenTheColumnPositionsHaveBeenConverted.
@Test
public void getColumnWidthWhenTheColumnPositionsHaveBeenConverted() {
DataLayerFixture dataLayer = new DataLayerFixture();
// Indexes re-ordered: 4 1 0 2 3
ColumnReorderLayer reorderLayerFixture = new ColumnReorderLayerFixture(dataLayer);
MultiColumnResizeCommand resizeCommand = new MultiColumnResizeCommand(reorderLayerFixture, new int[] { 1, 2 }, new int[] { 100, 150 });
reorderLayerFixture.doCommand(resizeCommand);
// As the Commands goes down the stack - positions might get converted
// to entirely different values.
assertEquals(-1, resizeCommand.getCommonColumnWidth());
assertEquals(-1, resizeCommand.getColumnWidth(5));
assertEquals(-1, resizeCommand.getColumnWidth(12));
assertEquals(100, resizeCommand.getColumnWidth(1));
assertEquals(150, resizeCommand.getColumnWidth(0));
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnReorderLayerFixture in project nebula.widgets.nattable by eclipse.
the class ColumnGroupExpandCollapseLayerTest method isFirstVisibleWithColumnsReordered.
@Test
public void isFirstVisibleWithColumnsReordered() throws Exception {
// Original indexes : 0 1 2 3 4
// Indexes reordered : 4 1 0 2 3
ColumnReorderLayer reorderLayer = new ColumnReorderLayerFixture();
this.underlyingLayer = new ColumnHideShowLayerFixture(reorderLayer);
this.expandCollapseLayer = new ColumnGroupExpandCollapseLayer(this.underlyingLayer, this.model);
this.model.clear();
this.model.addColumnsIndexesToGroup(TEST_GROUP_NAME, 0, 2, 3);
// Hide index 0
this.underlyingLayer.hideColumnPositions(Arrays.asList(2));
assertFalse(ColumnGroupUtils.isFirstVisibleColumnIndexInGroup(0, this.expandCollapseLayer, this.underlyingLayer, this.model));
assertTrue(ColumnGroupUtils.isFirstVisibleColumnIndexInGroup(2, this.expandCollapseLayer, this.underlyingLayer, this.model));
assertFalse(ColumnGroupUtils.isFirstVisibleColumnIndexInGroup(3, this.expandCollapseLayer, this.underlyingLayer, this.model));
}
Aggregations