RFR: 8328386: Convert java/awt/FileDialog/FileNameOverrideTest test to main

Alexander Zvegintsev azvegint at openjdk.org
Tue Mar 19 15:36:24 UTC 2024


On Mon, 18 Mar 2024 21:00:36 GMT, Alexander Zuev <kizune at openjdk.org> wrote:

> Convert applet based test to a main based test;
> Move test to an apporpriate location;
> Remove old files;

test/jdk/java/awt/FileDialog/FileNameOverrideTest.java line 32:

> 30:  * @build PassFailJFrame
> 31:  * @run main/manual FileNameOverrideTest
> 32:  */

We usually move this block just before a class declaration, for better readability.

test/jdk/java/awt/FileDialog/FileNameOverrideTest.java line 93:

> 91:                 1) Click on 'Show File Dialog' button. A file dialog will come up.
> 92:                 2) Double-click on '$clickDirName' and click OK.
> 93:                 3) The text in the text field will indicate if test is passed or failed.

It looks like we can remove the text field and its output altogether, and use `PassFailJFrame#forcePass`, `PassFailJFrame#forceFail` to finish the test.

test/jdk/java/awt/FileDialog/FileNameOverrideTest.java line 94:

> 92:                 2) Double-click on '$clickDirName' and click OK.
> 93:                 3) The text in the text field will indicate if test is passed or failed.
> 94:                 """;

Suggestion:

                """.replace("$clickDirName", clickDirName);

test/jdk/java/awt/FileDialog/FileNameOverrideTest.java line 100:

> 98:             instructions = """
> 99:                     The test is not applicable for $toolkit. Press Pass.
> 100:                     """. replace("$toolkit", toolkit);

There is no point in showing the instruction window in this case, it is probably better to just throw the `jtreg.SkippedException`.

test/jdk/java/awt/FileDialog/FileNameOverrideTest.java line 108:

> 106:                 .rows((int) instructions.lines().count() + 1)
> 107:                 .columns(50)
> 108:                 .testUI(FileNameOverrideTest::initialize)

It is possible to get rid of the extra frame, e.g. make the `initialize` return the "Show File Dialog" `JButton`

Suggestion:

                .splitUIBottom(FileNameOverrideTest::initialize)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18365#discussion_r1530610368
PR Review Comment: https://git.openjdk.org/jdk/pull/18365#discussion_r1530597135
PR Review Comment: https://git.openjdk.org/jdk/pull/18365#discussion_r1530621068
PR Review Comment: https://git.openjdk.org/jdk/pull/18365#discussion_r1530618895
PR Review Comment: https://git.openjdk.org/jdk/pull/18365#discussion_r1530603508


More information about the client-libs-dev mailing list