RFR: 8225131: Test DragSourceMotionListenerTest.java fails on Windows

Alexey Ivanov aivanov at openjdk.org
Mon Sep 15 19:29:50 UTC 2025


On Mon, 15 Sep 2025 06:24:15 GMT, Tejesh R <tr at openjdk.org> wrote:

> Test is failing frequently on mach5 machines. I have fixed it with stabilizations and moved the frame to center of the screen. After the fix several runs were made on mach5 and no failures were seen.

test/jdk/java/awt/dnd/DragSourceMotionListenerTest.java line 25:

> 23: 
> 24: import javax.imageio.ImageIO;
> 25: import java.awt.AWTEvent;

Haven't we agreed `javax.*` packages go after `java.*` packages?

test/jdk/java/awt/dnd/DragSourceMotionListenerTest.java line 139:

> 137: 
> 138:         Toolkit.getDefaultToolkit()
> 139:                 .addAWTEventListener(this, AWTEvent.MOUSE_EVENT_MASK);

This was correctly aligned to `.` of the chained call above.

test/jdk/java/awt/dnd/DragSourceMotionListenerTest.java line 178:

> 176:             robot.keyPress(KeyEvent.VK_CONTROL);
> 177:             robot.waitForIdle();
> 178:             robot.delay(100);

Won't `robot.setAutoWaitForIdle(true)` resolve the problem then? Or increasing the value passed to `robot.setAutoDelay`?

test/jdk/java/awt/dnd/DragSourceMotionListenerTest.java line 183:

> 181:             for (; !srcPoint.equals(dstOutsidePoint);
> 182:                  srcPoint.translate(sign(dstOutsidePoint.x - srcPoint.x),
> 183:                          sign(dstOutsidePoint.y - srcPoint.y))) {

I am for preserving the original formatting here, either.

test/jdk/java/awt/dnd/DragSourceMotionListenerTest.java line 191:

> 189:             for (int i = 0; i < 10; i++) {
> 190:                 robot.mouseMove(srcPoint.x, srcPoint.y++);
> 191:             }

Doesn't this block of `mouseMove` require `waitForIdle` too?

test/jdk/java/awt/dnd/DragSourceMotionListenerTest.java line 235:

> 233:     public void eventDispatched(AWTEvent e) {
> 234:         if (e.getID() == MouseEvent.MOUSE_RELEASED) {
> 235:             clickedComponent = (Component) e.getSource();

I'd rather preserve this line, no code is modified around it.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27283#discussion_r2349866838
PR Review Comment: https://git.openjdk.org/jdk/pull/27283#discussion_r2349869732
PR Review Comment: https://git.openjdk.org/jdk/pull/27283#discussion_r2349884450
PR Review Comment: https://git.openjdk.org/jdk/pull/27283#discussion_r2349871210
PR Review Comment: https://git.openjdk.org/jdk/pull/27283#discussion_r2349885275
PR Review Comment: https://git.openjdk.org/jdk/pull/27283#discussion_r2349901405


More information about the client-libs-dev mailing list