RFR: 8327856: Convert applet test SpanishDiacriticsTest.java to a main program

Alexey Ivanov aivanov at openjdk.org
Tue Mar 12 12:54:14 UTC 2024


On Mon, 11 Mar 2024 23:02:53 GMT, Phil Race <prr at openjdk.org> wrote:

> Converts the  manual applet test in the files ..
> SpanishDiacriticsTest/SpanishDiacriticsTest.html
> SpanishDiacriticsTest/SpanishDiacriticsTest.java
> .. to a main program using PassFailJFrame
> 
> Added requires windows since it seems very windows-specific.
> 
> I got rid of the redundant extra directory which makes the .java file "new" according to github but it is largely changed anyway

test/jdk/java/awt/InputMethods/SpanishDiacriticsTest.java line 60:

> 58:           expected behaviour for this test.
> 59: 
> 60:        If the text field displays ''o, (i.e. o should be without an acute)

Suggestion:

       If the text field displays \u00f3, (i.e. o should be without an acute)

Use the real character?

test/jdk/java/awt/InputMethods/SpanishDiacriticsTest.java line 71:

> 69:                       .rows(18)
> 70:                       .columns(50)
> 71:                       .testUI(() -> createTestUI())

Suggestion:

                      .testUI(SpanishDiacriticsTest::createTestUI)

I prefer method references in such cases, it looks cleaner.

test/jdk/java/awt/InputMethods/SpanishDiacriticsTest.java line 72:

> 70:                       .columns(50)
> 71:                       .testUI(() -> createTestUI())
> 72:                       .testTimeOut(5)

Default timeout could be omitted.

test/jdk/java/awt/InputMethods/SpanishDiacriticsTest.java line 89:

> 87:         frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
> 88:         frame.pack();
> 89:         frame.setVisible(true);

Suggestion:

        frame.pack();

Calling `setVisible(true)` here causes flickering as the frame gets shown at its default location and later gets moved to its final location.

Setting close operation is redundant, `PassFailJFrame` handles closing test UI (when you use the builder pattern) and fails the test.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18208#discussion_r1521405668
PR Review Comment: https://git.openjdk.org/jdk/pull/18208#discussion_r1521410458
PR Review Comment: https://git.openjdk.org/jdk/pull/18208#discussion_r1521410885
PR Review Comment: https://git.openjdk.org/jdk/pull/18208#discussion_r1521409226


More information about the client-libs-dev mailing list