RFR: 8314215: Trailing Spaces before Line Breaks Affect the Center Alignment of Text [v17]

Andy Goryachev angorya at openjdk.org
Tue Apr 23 19:27:36 UTC 2024


On Tue, 23 Apr 2024 19:20:22 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

>> tests/system/src/test/java/test/com/sun/javafx/text/TextLayoutTest.java line 453:
>> 
>>> 451:             TextLayoutTest::assumeMac,
>>> 452:             "The quick brown लोमड़ी jumps over the lazy कुत्ता",
>>> 453:             160.0f, List.of(155.3047f, 91.04719f)
>> 
>> Question: these numbers are compared exactly (Float::compare), can we expect them to be exactly the same on all possible platforms/versions?
>
> Exact comparisons on float numbers should not be a problem, as long as you don't assume that with a different order of operations you will get the same result.  For example, `y + x - y` may not exactly equal `x + y - y` or `x`.  Since we don't have different code paths for different platforms, and since all code paths are deterministic(*), it should be fine to do an exact comparison. 
> 
> If this ever does fail, I think then is a good time to do a more thorough investigation. So far these tests have run dozens of time on my machine, and on several of the machines of people reviewing without problems.
> 
> (*) In tests, the most often encountered source of non-determinism in Java is when a `Set` or `Map` is involved which contains objects with the default hash code which can change each time a new JVM is created; usually I change such collections to linked versions, or do an explicit sort somewhere to ensure it is deterministic again.

makes sense, thank you.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1236#discussion_r1576788278


More information about the openjfx-dev mailing list