use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.ViewportLayerFixture in project nebula.widgets.nattable by eclipse.
the class ViewportLayerTest method testMoveColumnPositionIntoViewportSimpleCase.
@Test
public void testMoveColumnPositionIntoViewportSimpleCase() {
this.viewportLayer = new ViewportLayerFixture();
assertEquals(0, this.viewportLayer.getColumnIndexByPosition(0));
assertEquals(1, this.viewportLayer.getColumnIndexByPosition(1));
assertEquals(2, this.viewportLayer.getColumnIndexByPosition(2));
this.viewportLayer.moveColumnPositionIntoViewport(3);
assertEquals(1, this.viewportLayer.getColumnIndexByPosition(0));
assertEquals(2, this.viewportLayer.getColumnIndexByPosition(1));
assertEquals(3, this.viewportLayer.getColumnIndexByPosition(2));
this.viewportLayer.moveColumnPositionIntoViewport(0);
assertEquals(0, this.viewportLayer.getColumnIndexByPosition(0));
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.ViewportLayerFixture in project nebula.widgets.nattable by eclipse.
the class ViewportLayerTest method testMoveColumnPositionIntoViewportForAColumnAlreadyInTheViewport.
@Test
public void testMoveColumnPositionIntoViewportForAColumnAlreadyInTheViewport() {
this.viewportLayer = new ViewportLayerFixture(new Rectangle(0, 0, 285, 100));
this.viewportLayer.moveColumnPositionIntoViewport(2);
assertEquals(0, this.viewportLayer.getColumnIndexByPosition(0));
assertEquals(1, this.viewportLayer.getColumnIndexByPosition(1));
assertEquals(2, this.viewportLayer.getColumnIndexByPosition(2));
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.ViewportLayerFixture in project nebula.widgets.nattable by eclipse.
the class ViewportLayerTest method setup.
@Before
public void setup() {
this.viewportLayer = new ViewportLayerFixture();
this.layerListener = new LayerListenerFixture();
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.ViewportLayerFixture in project nebula.widgets.nattable by eclipse.
the class ViewportLayerTest method adjustColOrigin.
@Test
public void adjustColOrigin() throws Exception {
this.viewportLayer = new ViewportLayerFixture(10, 20, 50, 20);
// Default client area: width 200, height 100
assertEquals(4, this.viewportLayer.getColumnCount());
this.viewportLayer.setOriginX(this.viewportLayer.getStartXOfColumnPosition(4));
assertEquals(4, this.viewportLayer.getColumnIndexByPosition(0));
assertEquals(200, this.viewportLayer.getStartXOfColumnPosition(4));
assertEquals(200, this.viewportLayer.adjustOriginX(this.viewportLayer.getStartXOfColumnPosition(4)));
// Try to scroll off the end
this.viewportLayer.setOriginX(this.viewportLayer.getStartXOfColumnPosition(9));
assertEquals(6, this.viewportLayer.getColumnIndexByPosition(0));
assertEquals(450, this.viewportLayer.getStartXOfColumnPosition(9));
assertEquals(300, this.viewportLayer.adjustOriginX(this.viewportLayer.getStartXOfColumnPosition(9)));
// Increase viewport width
this.viewportLayer.getClientAreaProvider().getClientArea().width = 500;
assertEquals(450, this.viewportLayer.getStartXOfColumnPosition(9));
assertEquals(0, this.viewportLayer.adjustOriginX(this.viewportLayer.getStartXOfColumnPosition(9)));
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.ViewportLayerFixture in project nebula.widgets.nattable by eclipse.
the class HorizontalScrollBarHandlerTest method init.
@Before
public void init() {
this.viewport = new ViewportLayerFixture();
this.scrollBar = ViewportLayerFixture.DEFAULT_SCROLLABLE.getHorizontalBar();
this.scrollHandler = new HorizontalScrollBarHandler(this.viewport, this.scrollBar);
assertEquals(0, this.viewport.getColumnIndexByPosition(0));
assertEquals(1, this.viewport.getColumnIndexByPosition(1));
}
Aggregations