RFR: 8340790: Open source several AWT Dialog tests - Batch 4

Harshitha Onkar honkar at openjdk.org
Tue Oct 8 16:59:00 UTC 2024


On Tue, 8 Oct 2024 10:39:34 GMT, Tejesh R <tr at openjdk.org> wrote:

> Open source these AWT Dialog tests:
> 
> java/awt/Dialog/FileDialogGetFileTest.java
> java/awt/Dialog/EnabledResetTest.java
> java/awt/Dialog/ChoiceModalDialogTest.java
> java/awt/Dialog/DialogBackgroundTest.java

Changes requested by honkar (Reviewer).

test/jdk/java/awt/Dialog/ChoiceModalDialogTest.java line 30:

> 28:  * @summary Tests that choice is releasing input capture when a modal
> 29:  *          dialog is shown
> 30:  * @run main ChoiceModalDialogTest

This test fails on macOS. Please check if this test needs to be added to the problemlist.

test/jdk/java/awt/Dialog/ChoiceModalDialogTest.java line 100:

> 98:             EventQueue.invokeAndWait(() -> {
> 99:                 r.mouseMove(tf.getLocationOnScreen().x + tf.getSize().width / 2,
> 100:                         tf.getLocationOnScreen().y + tf.getSize().height / 2);

Indentation here and at other locations
Suggestion:

                r.mouseMove(tf.getLocationOnScreen().x + tf.getSize().width / 2,
                                       tf.getLocationOnScreen().y + tf.getSize().height / 2);

test/jdk/java/awt/Dialog/ChoiceModalDialogTest.java line 105:

> 103:             r.waitForIdle();
> 104:             EventQueue.invokeAndWait(() -> {
> 105: 

Empty line

test/jdk/java/awt/Dialog/DialogBackgroundTest.java line 85:

> 83:     public TreeCopy(int windowNum, Window myParent) {
> 84:         super();
> 85:         setTitle("TreeCopy Frame #" + Integer.toString(windowNum));

Suggestion:

        setTitle("TreeCopy Frame #" + windowNum);

test/jdk/java/awt/Dialog/EnabledResetTest.java line 56:

> 54:                    If all the verifications are done, then test is
> 55:                    PASSED, else test fails.
> 56:                                               """;

Closing quotes placement here and at other places
Suggestion:

                   If all the verifications are done, then test is
                   PASSED, else test fails.
                   """;

test/jdk/java/awt/Dialog/FileDialogGetFileTest.java line 47:

> 45:                 3. If FileDialog.getFile return null then test PASSES,
> 46:                    else test FAILS automatically.
> 47:                                """;

Closing quote indentation.

test/jdk/java/awt/Dialog/FileDialogGetFileTest.java line 61:

> 59: 
> 60:     public static Frame initialize() {
> 61:         frame = new Frame();

Frame title missing

test/jdk/java/awt/Dialog/FileDialogGetFileTest.java line 74:

> 72:             } else {
> 73:                 PassFailJFrame.forcePass();
> 74:             }

For pass case instead of forcePass() the msg can be logged in logArea as it allows the user to see the msg.

Suggestion:

            if (fd.getFile() != null) {
                PassFailJFrame.forceFail("Test failed: FileDialog returned non-null value");
            } else {
                PassFailJFrame.log("Test passed: FileDialog returned null value as expected");
            }

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

PR Review: https://git.openjdk.org/jdk/pull/21404#pullrequestreview-2355029955
PR Review Comment: https://git.openjdk.org/jdk/pull/21404#discussion_r1792202469
PR Review Comment: https://git.openjdk.org/jdk/pull/21404#discussion_r1792203343
PR Review Comment: https://git.openjdk.org/jdk/pull/21404#discussion_r1792203663
PR Review Comment: https://git.openjdk.org/jdk/pull/21404#discussion_r1792206393
PR Review Comment: https://git.openjdk.org/jdk/pull/21404#discussion_r1792208529
PR Review Comment: https://git.openjdk.org/jdk/pull/21404#discussion_r1792213401
PR Review Comment: https://git.openjdk.org/jdk/pull/21404#discussion_r1792217790
PR Review Comment: https://git.openjdk.org/jdk/pull/21404#discussion_r1792216083


More information about the client-libs-dev mailing list