On Thu, 10 Sep 2026 04:30:07 GMT, Prasanta Sadhukhan <[email protected]> 
wrote:

> For me it still fails in HiDPI which is also mentioned in JBS comment. But it 
> does not fail for 1.25 but fails for 1.75, 2.25 etc so it seems there's some 
> product issue still to be fixed..
> 
> ```
> ./jdk/bin/java -Dsun.java2d.uiScale=1.75 OverriddenInsetsTest
> Test failed at 0 0 c=ff5050b0
> Dumped res to: OverriddenInsetsTest_res.png
> Exception in thread "main" java.lang.RuntimeException: Test FAILED.
>         at OverriddenInsetsTest.test(OverriddenInsetsTest.java:103)
>         at OverriddenInsetsTest.main(OverriddenInsetsTest.java:69)
> ```
> 
> ```
> ./jdk/bin/java -Dsun.java2d.uiScale=2.25 OverriddenInsetsTest
> Test failed at 99 0 c=ff3030cf
> Dumped res to: OverriddenInsetsTest_res.png
> Exception in thread "main" java.lang.RuntimeException: Test FAILED.
>         at OverriddenInsetsTest.test(OverriddenInsetsTest.java:103)
>         at OverriddenInsetsTest.main(OverriddenInsetsTest.java:69)
> ```

I also see this behaviour only in Windows.
After more analysis, i see that only Windows supports exact fractional scaling. 
Based on heavyweight component we pick different path at 
https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/java/awt/Robot.java#L613

Java2D rasterizes onto a scaled windows surface and for heavyweight components 
this is mapped to integer device pixels. Then robot screen-capture downsamples 
this 175x175 pixels to 100x100 logical pixels. This can result in picking 
different pixels on edges.

Capturing the failed output at 1.75/2.25 scaling in Windows shows that only 
some part of edge pixels are not matching the expected results. This is not 
some product bug in paint/rendering. Attached output of these images.

<img width="100" height="100" alt="OverriddenInsetsTest_res_1_75" 
src="https://github.com/user-attachments/assets/cabcbb28-0bac-4c84-87d5-3511af630dd4";
 />
<img width="100" height="100" alt="OverriddenInsetsTest_res_2_25" 
src="https://github.com/user-attachments/assets/4e68e821-90d3-48e6-810a-406c7772c06e";
 />


Also if we check the history, this test was added under 
[JDK-6694230](https://bugs.openjdk.org/browse/JDK-6694230). After this, test 
was never updated to actually use HiDPI. I don't know why this test was 
completely problemlisted on all platforms just because we saw some failures 
using HiDPI on windows. This test should be removed from problem list, so that 
we can have actual coverage for which it was written.

I don't see windows specific product issue and this test should ignore the edge 
pixels.

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

PR Comment: https://git.openjdk.org/jdk/pull/32779#issuecomment-5616124469

Reply via email to