RFR: 8258663: Fixed size TableCells are not removed from sene graph when column is removed

Jeanette Winzenburg fastegal at openjdk.java.net
Tue Mar 30 13:30:10 UTC 2021


On Sun, 28 Mar 2021 23:13:22 GMT, Marius Hanl <github.com+66004280+Maran23 at openjdk.org> wrote:

> This PR fixes an issue, where table cells are not removed from the table row when the corresponding table column got removed. This will lead to empty "ghost" cells laying around in the table.
> This bug only occurs, when a fixed cell size is set to the table.
> 
> I also added 3 more tests beside the mandatory test, which tests my fix.
> 1 alternative test, which tests the same with no fixed cell size set.
> The other 2 tests are testing the same, but the table columns are set invisible instead.
> 
> -> Either the removal or setVisible(false) of a column should both do the same: Remove the corresponding cells, so that there are no empty cells.
> Therefore, the additional tests make sure, that the other use cases (still) works and won't break in future (at least, without red tests ;)).
> See also: TableRowSkinBase#updateCells(boolean)

modules/javafx.controls/src/test/java/test/javafx/scene/control/skin/TableRowSkinTest.java line 132:

> 130:         // We save the first table row to check it later.
> 131:         AtomicReference<TableRow<Person>> tableRowRef = new AtomicReference<>();
> 132: 

wondering a bit about this complicated test setup .. are you aware of the VirtualFlowTestUtils (in test.something.infrastructure)? Using it, a test would shrink down to something like:

    @Test
    public void testRemoveColumnsFixed() {
        tableView.setFixedCellSize(20);
        tableView.getColumns().remove(0, 2);
        Toolkit.getToolkit().firePulse();
        assertEquals(tableView.getVisibleLeafColumns().size(), 
                VirtualFlowTestUtils.getCell(tableView, 0).getChildrenUnmodifiable().size());
    }

Or what am I missing?

-------------

PR: https://git.openjdk.java.net/jfx/pull/444


More information about the openjfx-dev mailing list