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

Ziad El Midaoui zelmidaoui at openjdk.org
Thu May 8 16:04:05 UTC 2025


On Thu, 8 May 2025 15:03:25 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> Ziad El Midaoui has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fixed minor issues and added test
>
> 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.

that's true, I did use it at first with a tolerance of 0.01 which is minimal and it didn't make a difference in this test since it's not some complex test case. 
But I will add it and use 1e-6.
`assertEquals(first, x, 1e-6, "Alignment mismatch for item: " + entry.getKey());`

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1715#discussion_r2080018133


More information about the openjfx-dev mailing list