RFR: 8315882: Open some swing tests 2 [v3]

Harshitha Onkar honkar at openjdk.org
Thu Sep 21 17:36:43 UTC 2023


On Thu, 21 Sep 2023 03:41:27 GMT, Alisen Chung <achung at openjdk.org> wrote:

>> Moving some tests to open
>> 5 javax/swing/ScrollPaneLayout/4688907/bug4688907.java
>> 6 javax/swing/SpringLayout/4756178/bug4756178.java
>> 7 javax/swing/SpringLayout/4803649/bug4803649.java
>
> Alisen Chung has updated the pull request incrementally with one additional commit since the last revision:
> 
>   removed headless on one test, add newline on EOF

Changes requested by honkar (Committer).

test/jdk/javax/swing/JScrollPane/bug4688907.java line 31:

> 29: import java.awt.Dimension;
> 30: import javax.swing.JScrollPane;
> 31: import javax.swing.SwingUtilities;

Remove unused import

test/jdk/javax/swing/SpringLayout/bug4756178.java line 68:

> 66:                 fr.setLocationRelativeTo(null);
> 67:                 fr.setVisible(true);
> 68: 

Extra new line can be removed.

test/jdk/javax/swing/SpringLayout/bug4756178.java line 74:

> 72:                 throw new RuntimeException("Button size is " + bt.getSize() +
> 73:                         ", should be " + buttonPreferredSize);
> 74:             }

Delay (`Thread.sleep()`) should be add after frame is shown and bt.getSize() should be wrapped in EDT.
The delay ensures the frame is updated before querying the button size.

Suggestion:

          Thread.sleep(1000);
            SwingUtilities.invokeAndWait(() -> actualSize = bt.getSize());
            if (!buttonPreferredSize.equals(actualSize)) {
                throw new RuntimeException("Button size is " + actualSize +
                        ", should be " + buttonPreferredSize);
            }

actualSize can be static volatile var similar to buttonPreferredSize.

test/jdk/javax/swing/SpringLayout/bug4803649.java line 41:

> 39: public class bug4803649 {
> 40:     static JFrame fr;
> 41:     static JPanel panel;

panel can be made local var.

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

PR Review: https://git.openjdk.org/jdk/pull/15850#pullrequestreview-1638349153
PR Review Comment: https://git.openjdk.org/jdk/pull/15850#discussion_r1333377934
PR Review Comment: https://git.openjdk.org/jdk/pull/15850#discussion_r1333379252
PR Review Comment: https://git.openjdk.org/jdk/pull/15850#discussion_r1333397379
PR Review Comment: https://git.openjdk.org/jdk/pull/15850#discussion_r1333379594


More information about the client-libs-dev mailing list