RFR: 8340344: The first item in TreeView is not aligned in the beginning [v3]

Andy Goryachev angorya at openjdk.org
Thu May 8 15:11:10 UTC 2025


On Thu, 8 May 2025 14:59:40 GMT, Ziad El Midaoui <zelmidaoui at openjdk.org> wrote:

>> The issue occurred because items preceding an item with children (items with a disclosure node) had different widths, which led to misalignment. This can be fixed by requesting a cell relayout whenever the disclosure node's width changes.
>
> Ziad El Midaoui has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fixed minor issues and added test

Good job figuring out the fix and coming up with a test!

- the reproducer in the ticket works correctly after the fix
- the test fails in the master and passes with the fix

left some minor comments, but I think it is in a very good shape.

modules/javafx.controls/src/test/java/test/javafx/scene/control/TreeViewTest.java line 4120:

> 4118:         for (Map.Entry<String, Double> entry : layoutXMap.entrySet()) {
> 4119:             double x = entry.getValue();
> 4120:             assertEquals(first, x, "Alignment mismatch for item: " + entry.getKey());

typically when we compare results of a floating point computation, we should not use exact comparison, due to accumulation of small errors stemming from inexact nature of floating point values.  the amount of allowed difference depends on the magnitude of values and a number of operations.  we usually throw 1e-6 or something like that.

it might be ok here, because the computation goes through the same path and same values each time.

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

PR Review: https://git.openjdk.org/jfx/pull/1715#pullrequestreview-2825387702
PR Review Comment: https://git.openjdk.org/jfx/pull/1715#discussion_r2079906716


More information about the openjfx-dev mailing list