On Sat, 20 Jun 2026 13:21:26 GMT, Marius Hanl <[email protected]> wrote:

>> This PR fixes the computeSize methods not considering the gap in some cases.
>> 
>> It also fixes a missed spot, in the previous PR for JDK-8092379.
>> 
>> Each fix is covered by simple tests which fail before and work after the 
>> change.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> modules/javafx.graphics/src/test/java/test/javafx/scene/layout/GridPaneTest.java
>  line 3174:
> 
>> 3172: 
>> 3173:     static class FixedAreaRegion extends Region {
>> 3174:         final double AREA = 100*100;
> 
> Suggestion:
> 
>         final double AREA = 10000;

or perhaps declare `HEIGHT`, `WIDTH`, and `AREA = HEIGHT * WIDTH`

(but 100*100 is more meaningful in the context)

> modules/javafx.graphics/src/test/java/test/javafx/scene/layout/GridPaneTest.java
>  line 3215:
> 
>> 3213: 
>> 3214:         assertEquals(70, fixedArea.getWidth());
>> 3215:         fixedArea.checkSize();
> 
> I would rather prefer an accurate assertions here and below. This also makes 
> it more understandable what the test does IMO.
> 
> The you can also remove the `checkSize` method.
> 
> Suggestion:
> 
>         assertEquals(143, fixedArea.getHeight());
> 
> 
> or
> 
> Suggestion:
> 
>         assertEquals(Math.round(FixedAreaRegion.AREA / 70), 
> fixedArea.getHeight());

floating point operations might be inexact, so a small tolerance is required in 
`assertEquals` in general case (and should be anticipated in comparisons).  

In this test, there is no chance to see fractional scale or non-integer sizes, 
so we are ok with exact `assertEquals`.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2187#discussion_r3454082372
PR Review Comment: https://git.openjdk.org/jfx/pull/2187#discussion_r3454075499

Reply via email to