RFR: 8328648: Remove applet usage from JFileChooser tests bug4150029 [v3]

Abhishek Kumar abhiscxk at openjdk.org
Tue Mar 26 15:43:27 UTC 2024


On Tue, 26 Mar 2024 02:20:35 GMT, Alisen Chung <achung at openjdk.org> wrote:

>> Removing applet usage from manual JFileChooser tests
>
> Alisen Chung has updated the pull request incrementally with one additional commit since the last revision:
> 
>   change to automatic test

test/jdk/javax/swing/JFileChooser/4150029/bug4150029.java line 43:

> 41:  * @library /test/lib /java/awt/regtesthelpers
> 42:  * @build jdk.test.lib.Platform PassFailJFrame
> 43:  * @run main/manual bug4150029

Not a manual test anymore, please remove manual test related tags and library.

test/jdk/javax/swing/JFileChooser/4150029/bug4150029.java line 88:

> 86:             fileChooser = new JFileChooser(subDir);
> 87: 
> 88: //            fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

Not required to keep commented code.

test/jdk/javax/swing/JFileChooser/4150029/bug4150029.java line 91:

> 89: 
> 90:             SwingUtilities.invokeAndWait(() -> {
> 91:                 frame = new JFrame("Backspace Shortcut for Directory Navigation Test");

Block of code can be moved to separate method to create and show UI elements.

test/jdk/javax/swing/JFileChooser/4150029/bug4150029.java line 113:

> 111: 
> 112:     private static void doTesting() {
> 113:         Point p = frame.getLocationOnScreen();

should be on EDT.

test/jdk/javax/swing/JFileChooser/4150029/bug4150029.java line 115:

> 113:         Point p = frame.getLocationOnScreen();
> 114:         robot.mouseMove(p.x + 200, p.y + 200);
> 115:         robot.mousePress(InputEvent.BUTTON1_MASK);

Suggestion:

        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);


should we add `robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);` too ?

test/jdk/javax/swing/JFileChooser/4150029/bug4150029.java line 136:

> 134:         }
> 135: 
> 136:         if (passed_1 && passed_2) {

I think no need to print "Test Passed", can check for not passed and throw the runtime exception inside if block.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18415#discussion_r1539499125
PR Review Comment: https://git.openjdk.org/jdk/pull/18415#discussion_r1539501818
PR Review Comment: https://git.openjdk.org/jdk/pull/18415#discussion_r1539503277
PR Review Comment: https://git.openjdk.org/jdk/pull/18415#discussion_r1539503917
PR Review Comment: https://git.openjdk.org/jdk/pull/18415#discussion_r1539510138
PR Review Comment: https://git.openjdk.org/jdk/pull/18415#discussion_r1539515462


More information about the client-libs-dev mailing list