RFR: 8327840: Automate javax/swing/border/Test4129681.java

Abhishek Kumar abhiscxk at openjdk.org
Mon Mar 18 08:16:27 UTC 2024


On Sat, 16 Mar 2024 07:43:18 GMT, Tejesh R <tr at openjdk.org> wrote:

> Automated the Test `javax/swing/border/Test4129681.java` from manual as suggested in JBS description.
> Verified in CI system and its Green. The test has been verified for Metal L&F and the same is set explicitly..

test/jdk/javax/swing/border/Test4129681.java line 48:

> 46:     private static final Dimension SIZE = new Dimension(100, 40);
> 47:     private static final Point startPoint = new Point(8, 4);
> 48:     private static final Point endPoint = new Point(18, 14);

I think all variables can be defined locally inside main.

test/jdk/javax/swing/border/Test4129681.java line 55:

> 53:         int tolerance = 20;
> 54: 
> 55:         UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");

Is the test exclusive for Metal Look And Feel or should it be checked in other LAFs as well?
I think it may not work for Nimbus of GTK LAF as setting the property `UIManager.getDefaults().put("Label.disabledForeground", labelDisableColor);` may not work.

test/jdk/javax/swing/border/Test4129681.java line 62:

> 60:         label.setSize(SIZE);
> 61:         label.setEnabled(false);
> 62:         BufferedImage image = new BufferedImage((int) Math.ceil(label.getWidth()),

It can be - 
BufferedImage(label.getWidth(), label.getHeight(),
                TYPE_INT_RGB);

Why Math.ceil is required ?

test/jdk/javax/swing/border/Test4129681.java line 79:

> 77:         }
> 78: 
> 79:         if (((double)correctColoredPixels/totalPixels*100) <= tolerance) {

fix spacing.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18336#discussion_r1528024716
PR Review Comment: https://git.openjdk.org/jdk/pull/18336#discussion_r1528032073
PR Review Comment: https://git.openjdk.org/jdk/pull/18336#discussion_r1528025999
PR Review Comment: https://git.openjdk.org/jdk/pull/18336#discussion_r1528027557


More information about the client-libs-dev mailing list