RFR: 8316211: Open source several manual applet tests [v3]

Alexey Ivanov aivanov at openjdk.org
Mon Sep 25 16:47:23 UTC 2023


On Fri, 22 Sep 2023 15:43:18 GMT, Alexander Zvegintsev <azvegint at openjdk.org> wrote:

>> Open sourcing several manual applet tests
>> 
>> 
>> test/jdk/java/awt/Frame/DefaultSizeTest.java
>> test/jdk/java/awt/LightweightComponent/LightweightCliprect.java
>> test/jdk/java/awt/event/KeyEvent/FunctionKeyTest.java
>> test/jdk/javax/swing/JFrame/DefaultCloseOperation.java
>
> Alexander Zvegintsev has updated the pull request incrementally with one additional commit since the last revision:
> 
>   review comments

test/jdk/java/awt/Frame/DefaultSizeTest.java line 42:

> 40:             and should be the minimum size allowed by the window manager.
> 41:             For any WM, the frame should be very small.
> 42:             When the test is complete, click Pass or Fail as appropriate.

I guess we can't determine the minimum size, yet it's a bit confusing.

Reading [JDK-4033151](https://bugs.openjdk.org/browse/JDK-4033151) reveals the frame remained invisible on Solaris 2.5 and appeared in virtual desktop with a large size.

Being more specific could still help: If the frame is not large, click Pass or Fail otherwise.

This test would benefit from screenshots.

test/jdk/java/awt/Frame/DefaultSizeTest.java line 55:

> 53:                 .build();
> 54: 
> 55:         SwingUtilities.invokeAndWait(() -> {

Suggestion:

        EventQueue.invokeAndWait(() -> {

Using `EventQueue` is more appropriate for AWT components.

test/jdk/java/awt/LightweightComponent/LightweightCliprect.java line 47:

> 45:     private static final String INSTRUCTIONS = """
> 46:             If some text is drawn outside the red rectangle press "Fail" button.
> 47:             Otherwise press "Pass" button.

Suggestion:

            If some text is drawn outside the red rectangle, press "Fail" button.
            Otherwise, press "Pass" button.

test/jdk/java/awt/LightweightComponent/LightweightCliprect.java line 87:

> 85:         g.fillRect(20, 20, 400, 200);
> 86:         Rectangle clip;
> 87:         clip = g.getClipBounds();

Suggestion:

        Rectangle clip = g.getClipBounds();

Since this object is used to restore the clip, using `g.getClip()` is better — you'll restore the clip to its original value. The `Shape` could be non-rectangular, or it could consist of several rectangles which don't intersect.

test/jdk/javax/swing/JFrame/DefaultCloseOperation.java line 1:

> 1: /*

I wonder if this test can be automated… On Windows, one could use `Alt+F4` or close the window using robot. On macOS, the close button is also available but it's on the left of the window. On Linux, it's close to impossible because of different window managers.

test/jdk/javax/swing/JFrame/DefaultCloseOperation.java line 48:

> 46: public class DefaultCloseOperation extends JPanel {
> 47:     private static final String INSTRUCTIONS = """
> 48:         This is a manual test (requires user interaction) which tests the

I guess the instructions should be amended so that it is clear what is required from the tester.

“To run this test, do the following steps…” could be replaced with “Do (Perform) the following steps…”.

jtreg automatically handles exceptions, it will fail there's an unhandled exception in the test.

test/jdk/javax/swing/JFrame/DefaultCloseOperation.java line 78:

> 76:          -  Select "Dispose" from the "JDialog Default Close Operation" ComboBox
> 77:          -  On the TestDialog, select "Close" from the system menu (the window should go away)
> 78:         """;

I guess this test should disable Pass and Fail buttons. The Fail button should remain disabled: the test will fail automatically. Yet the Pass button may always be enabled, or it could be enabled only after the tester cycles through all the scenarios.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15827#discussion_r1336079278
PR Review Comment: https://git.openjdk.org/jdk/pull/15827#discussion_r1336074132
PR Review Comment: https://git.openjdk.org/jdk/pull/15827#discussion_r1336080349
PR Review Comment: https://git.openjdk.org/jdk/pull/15827#discussion_r1336083937
PR Review Comment: https://git.openjdk.org/jdk/pull/15827#discussion_r1336149065
PR Review Comment: https://git.openjdk.org/jdk/pull/15827#discussion_r1336123609
PR Review Comment: https://git.openjdk.org/jdk/pull/15827#discussion_r1336145672


More information about the client-libs-dev mailing list