On Mon, 25 Mar 2024 22:49:22 GMT, Marius Hanl <mh...@openjdk.org> wrote:

>> modules/javafx.controls/src/test/java/test/javafx/scene/chart/AreaChartTest.java
>>  line 538:
>> 
>>> 536:                 .map(lineTo -> new Point2D(
>>> 537:                         
>>> Math.ceil(xAxis.getValueForDisplay(lineTo.getX()).doubleValue()),
>>> 538:                         
>>> Math.ceil(yAxis.getValueForDisplay(lineTo.getY()).doubleValue()))
>> 
>> would it make more sense to either do a Math.round(), or better yet - write 
>> a utility that computes array equality of Point2D's with some non-zero 
>> tolerance?
>> 
>> Do we have more tests like this that might warrant a new utility?
>
> AFAIK, we do not have other tests with that problem.
> I tried to keep the diff small, but nothing against writing a better method 
> to compare the points here with a delta.

I am not sure why this is needed here, so my concern stems from the fact that 
`ceil()` might introduce a large bias (0.000001 -> 1.0), and `rnd()` _seems_ to 
be a better choice.

But then again, ceil() or rnd() might be a wrong thing to do if we are dealing 
with scaled coordinates and we don't expect the whole integers, but instead are 
dealing with small differences between expected and obtained values (in which 
case a better comparison is required).

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1422#discussion_r1538353288

Reply via email to