RFR: 8328158: Convert java/awt/Choice/NonFocusablePopupMenuTest to automatic main test

Abhishek Kumar abhiscxk at openjdk.org
Thu Mar 14 12:47:40 UTC 2024


On Thu, 14 Mar 2024 12:27:29 GMT, Alexander Zuev <kizune at openjdk.org> wrote:

> Convert test to the automatic main and move it from its own folder since it is no longer required.

test/jdk/java/awt/Choice/NonFocusablePopupMenuTest.java line 46:

> 44:     Choice choice;
> 45:     Point pos;
> 46:     Dimension size;

Should we declare `Point` and `Dimesnion` variable as volatile?

test/jdk/java/awt/Choice/NonFocusablePopupMenuTest.java line 65:

> 63:         });
> 64:         robot.waitForIdle();
> 65:         SwingUtilities.invokeAndWait(() -> {

Is it ok to have SwingUtilities.invokeAndWait? 
Or should we use EventQueue.invokeAndWait ?

test/jdk/java/awt/Choice/NonFocusablePopupMenuTest.java line 69:

> 67:             size = choice.getSize();
> 68:         });
> 69:         int selected = choice.getSelectedIndex();

choice accessed outside EDT.

test/jdk/java/awt/Choice/NonFocusablePopupMenuTest.java line 74:

> 72:         robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
> 73:         robot.waitForIdle();
> 74:         robot.delay(500);

Any specific reason to have 500 ms delay. Can it be reduced?

test/jdk/java/awt/Choice/NonFocusablePopupMenuTest.java line 79:

> 77:         robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
> 78:         robot.waitForIdle();
> 79:         robot.delay(500);

same here as well.

test/jdk/java/awt/Choice/NonFocusablePopupMenuTest.java line 84:

> 82:             dispose();
> 83:         });
> 84:         if (choice.getSelectedIndex() == selected) {

`choice.getSelectedIndex()` accessed outside EDT.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18300#discussion_r1524770591
PR Review Comment: https://git.openjdk.org/jdk/pull/18300#discussion_r1524773238
PR Review Comment: https://git.openjdk.org/jdk/pull/18300#discussion_r1524773831
PR Review Comment: https://git.openjdk.org/jdk/pull/18300#discussion_r1524775195
PR Review Comment: https://git.openjdk.org/jdk/pull/18300#discussion_r1524775871
PR Review Comment: https://git.openjdk.org/jdk/pull/18300#discussion_r1524777069


More information about the client-libs-dev mailing list