On Mon, 22 Jun 2026 17:05:39 GMT, Andy Goryachev <[email protected]> wrote:

>> 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`.

I added my reasoning for using the checkSize method instead of having the 
asserts inside the tests.
If its not convincing, I'll change them to the suggested versions.

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

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

Reply via email to