RFR: 8305709: [testbug] Tree/TableViewResizeColumnToFitContentTest fails with fractional screen scale

Andy Goryachev angorya at openjdk.org
Wed Sep 20 17:55:47 UTC 2023


On Wed, 20 Sep 2023 14:46:35 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> Snapping introduces differences between computed values and snapped values, so we need to use non-zero tolerance when checking for equality.  The maximum tolerance is (1 / scale) - one display pixel scaled back to the local coordinates.
>> 
>> The tests have been modified to use the scale-specific tolerance.
>> 
>> Tested with macOS at scale 1.0 and win11 at scales (100%, 125%, 150%, 175%).
>
> tests/system/src/test/java/test/util/Util.java line 490:
> 
>> 488:                     double scale = win.getRenderScaleX();
>> 489:                     // distance between pixels in the local (unscaled) coordinates is (1 / scale)
>> 490:                     return 1.0 / scale;
> 
> Is this computation what you want? This will give a smaller tolerance for a screen scale of, say, 2.0 (0.5) than it will for 1.0 (1). Intuitively, this seems backwards. For a screen scale of 1, a tolerance of 1 might be too large, whereas for a screen scale of 3, a tolerance of 0.3333 might be too small. If the goal is to account for the results of snapping, then would a fixed tolerance of 0.5 be better? It's possible I'm missing something.

this tolerance is to account for snapping, but it should be one half of the display pixel instead of the whole pixel (i.e. `0.5 / scale`).
With 0.5, these tests fail because we need JDK-8299753 to go first (and pass with the fix).

What we can do is to merge this change and change the tolerance as a part of JDK-8299753.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1234#discussion_r1331993490


More information about the openjfx-dev mailing list