RFR: 8354214: Open source Swing tests Batch 2 [v2]

Abhishek Kumar abhiscxk at openjdk.org
Mon Apr 14 12:55:28 UTC 2025


On Mon, 14 Apr 2025 11:41:31 GMT, Jayathirth D V <jdv at openjdk.org> wrote:

>> Few swing JList tests are open sourced.
>
> Jayathirth D V has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update after review

test/jdk/javax/swing/JList/bug4193267.java line 44:

> 42: import java.awt.Color;
> 43: import java.awt.FlowLayout;
> 44: import java.awt.GridLayout;

awt imports can be moved before swing here and in other tests too

test/jdk/javax/swing/JList/bug4193267.java line 64:

> 62:             .positionTestUI(WindowLayouts::rightOneRow)
> 63:             .columns(35)
> 64:             .testUI(initialize())

Suggestion:

            .testUI(bug4193267::initialize)

test/jdk/javax/swing/JList/bug4193267.java line 77:

> 75:         JList lst;
> 76:         JScrollPane jsp;
> 77:         JTextField first, last;

Can be removed.

test/jdk/javax/swing/JList/bug4193267.java line 80:

> 78:         JFrame[] fr = new JFrame[2];
> 79:         fr[0] = new JFrame("JList");
> 80:         lst = new JList(data);

separate declaration can be removed for JList, JScrollPane and JTextField 

Suggestion:

        JList lst = new JList(data);

test/jdk/javax/swing/JList/bug4193267.java line 83:

> 81:         lst.setLayoutOrientation(JList.VERTICAL_WRAP);
> 82:         lst.setVisibleRowCount(4);
> 83:         jsp = new JScrollPane(lst);

Suggestion:

        JScrollPane jsp = new JScrollPane(lst);

test/jdk/javax/swing/JList/bug4193267.java line 94:

> 92:         JPanel p = new JPanel();
> 93:         p.setLayout(new GridLayout(2, 1));
> 94:         first = new JTextField("0", 2);

Suggestion:

        JTextField first = new JTextField("0", 2);

test/jdk/javax/swing/JList/bug4193267.java line 98:

> 96:         first.setBackground(Color.white);
> 97:         p.add(first);
> 98:         last = new JTextField("9", 2);

Suggestion:

        JTextField last = new JTextField("9", 2);

test/jdk/javax/swing/JList/bug4249161.java line 59:

> 57:             .instructions(INSTRUCTIONS)
> 58:             .columns(35)
> 59:             .testUI(initialize())

Suggestion:

            .testUI(bug4249161::initialize)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24588#discussion_r2041949275
PR Review Comment: https://git.openjdk.org/jdk/pull/24588#discussion_r2041960565
PR Review Comment: https://git.openjdk.org/jdk/pull/24588#discussion_r2041958918
PR Review Comment: https://git.openjdk.org/jdk/pull/24588#discussion_r2041957565
PR Review Comment: https://git.openjdk.org/jdk/pull/24588#discussion_r2041957793
PR Review Comment: https://git.openjdk.org/jdk/pull/24588#discussion_r2041957997
PR Review Comment: https://git.openjdk.org/jdk/pull/24588#discussion_r2041958201
PR Review Comment: https://git.openjdk.org/jdk/pull/24588#discussion_r2041961750


More information about the client-libs-dev mailing list