Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8178297: TableView scrolls slightly when adding new elements
Reviewed-by: kcr, aghaisas
  • Loading branch information
Jose Pereda committed Oct 12, 2020
1 parent a56ba63 commit 205e4b9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
Expand Up @@ -1893,9 +1893,9 @@ void setViewportLength(double value) {
private void positionCell(T cell, double position) {
if (isVertical()) {
cell.setLayoutX(0);
cell.setLayoutY(snapSizeY(position));
cell.setLayoutY(snapSpaceY(position));
} else {
cell.setLayoutX(snapSizeX(position));
cell.setLayoutX(snapSpaceX(position));
cell.setLayoutY(0);
}
}
Expand Down
Expand Up @@ -1169,6 +1169,28 @@ public void testScrollOneCellHorizontal() {
assertLastCellInsideViewport(false);
}

@Test
// see JDK-8178297
public void testPositionCellRemainsConstant() {
flow.setVertical(true);
flow.setCellCount(20);
flow.resize(300, 300);
flow.scrollPixels(10);
pulse();

IndexedCell vc = flow.getCell(0);
double cellPosition = flow.getCellPosition(vc);
assertEquals("Wrong first cell position", -10d, cellPosition, 0d);

for (int i = 1; i < 10; i++) {
flow.setCellCount(20 + i);
pulse();
vc = flow.getCell(0);
cellPosition = flow.getCellPosition(vc);
assertEquals("Wrong first cell position after inserting " + i + " cells", -10d, cellPosition, 0d);
}
}

@Test
// see JDK-8252811
public void testSheetChildrenRemainsConstant() {
Expand Down

0 comments on commit 205e4b9

Please sign in to comment.