<Swing Dev> RFR: 8163367: Test javax/swing/JComboBox/8033069/bug8033069NoScrollBar.java javax/swing/JComboBox/8033069/bug8033069ScrollBar.java fails intermittently

Alexey Ivanov aivanov at openjdk.java.net
Mon Apr 26 20:04:35 UTC 2021


On Sun, 25 Apr 2021 16:27:46 GMT, Pankaj Bansal <pbansal at openjdk.org> wrote:

> The tests a javax/swing/JComboBox/8033069/bug8033069ScrollBar.java and javax/swing/JComboBox/8033069/bug8033069NoScrollBar.java fails intermittently. The tests have a few problems which could cause this behaviour and the are being fixed here.
> 
> 1. Test access the Swing components without EDT thread at couple of places.
> 2. Test is not calling waitForIdle or delay after Robot.mouseMove operations.
> 
> There is some additional cleanup done in the fix and moved the frame in centre. The tests pass with multiple iterations on CI. Link in the JBS.

test/jdk/javax/swing/JComboBox/8033069/bug8033069NoScrollBar.java line 64:

> 62: 
> 63:     private Point p;
> 64:     private Dimension d;

Both should be `volatile` as they're accessed from two different threads.

test/jdk/javax/swing/JComboBox/8033069/bug8033069NoScrollBar.java line 120:

> 118:                 d = cb1.getSize();
> 119:             });
> 120:             robot.waitForIdle();

Is it needed here?
The block above does not modify the state of the UI.

test/jdk/javax/swing/JComboBox/8033069/bug8033069NoScrollBar.java line 123:

> 121: 
> 122:             robot.mouseMove(p.x + d.width / 2, p.y + d.height / 2);
> 123:             robot.waitForIdle();

I believe the delay between mouseMove and mousePress/Release is unneeded, does it really make a difference?

test/jdk/javax/swing/JComboBox/8033069/bug8033069NoScrollBar.java line 175:

> 173:             if (frame != null) {
> 174:                 SwingUtilities.invokeAndWait(frame::dispose);
> 175:             }

The frame is still accessed from two different threads.

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

PR: https://git.openjdk.java.net/jdk/pull/3678


More information about the swing-dev mailing list