On Sat, 8 Oct 2022 05:04:57 GMT, Prasanta Sadhukhan <[email protected]>
wrote:
> javax/swing/JRadioButton/4314194/bug4314194.java correct color pixels pixel %
> varies between 30% for Metal to about 20% for Nimbus to about 19% for Windows
> L&F. But Nimbus in linux correct color pixel % falls to about 14%
> so adjusted % tolerance check to 10
> Also, JDK-8075916 is fixed for NimbusL&F but same issue is present for GTK
> L&F which is to be addressed separately as JDK-8295006 so problemlisted for
> now
I propose using the ‘full block’ character (U+2588 █) which results in a text
filled with the selected color. _The tolerance_ could be even increased in this
case.
checkBox = new JCheckBox("\u2588".repeat(5));
radioButton = new JRadioButton("\u2588".repeat(5));
Otherwise, the test depends on the font used, if the strokes are thin, it may
fail.
As I posted in the comment, the test should disable antialiasing and count the
pixels of the correct color, it should ignore the pixels of the background
color. To accommodate for anti-aliasing on macOS and rendering of the control
itself, the tolerance which is already in place could be used. I can take on
this improvement. Changing the text of the controls should already make the
test robust enough.
-------------
Changes requested by aivanov (Reviewer).
PR: https://git.openjdk.org/jdk/pull/10618