JDK-8155744 : [TEST_BUG] robot.mouseMove again broken on Unity dual-screen
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 9
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2016-04-29
  • Updated: 2018-09-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Related Reports
Relates :  
See JDK-8013116 and correspondent regtest 

The test fails after a change introduced in jdk9 b105. The robot moves mouse pointer not to the second screen NW corner + some 150 but to the far edge of the second screen.

It's not easy to reproduce the success since the current state of the test won't run without Jake M3 and too old won't compile because of the peer usage: try if you need some state circa b100.

Anyway, I tried and found the regression was in b105.
This is not reproducible on Windows 10 unless the scale factor of two displays is different. When the scale factor of two screens is different, the frame.getLocationOnScreen starts giving wrong location and test fails. If the two scales are same, test always passes. I think different bug should be filled and this should be closed as the description above is different that the actual behavior now.

RULE "java/awt/Multiscreen/MouseEventTest/MouseEventTest.java" Exception java.lang.RuntimeException: An expected mouse motion event was not received on the screen #1 RULE "java/awt/Multiscreen/MultiScreenLocationTest/MultiScreenLocationTest.java" Exception java.lang.RuntimeException: Robot.mouseMove test failed on Screen #1! RULE "java/awt/Multiscreen/MouseEventTest/MouseEventTest.java" Exception java.lang.IllegalArgumentException: Window must not be zero

Yes, that seems to be true, thank you.

Yuri do you agree with above?

According to the Robot(GraphicsDevice screen) specs: Note that depending on the platform configuration, multiple screens may either: - share the same coordinate system to form a combined virtual screen - use different coordinate systems to act as independent screens <<<---- This constructor is meant for the latter case. ----- Both tests violate this spec: "java/awt/Multiscreen/MouseEventTest/MouseEventTest.java" 55 Robot robot = new Robot(gd); 85 robot.mouseMove(point.x, point.y); 78 if (point.equals(e.getLocationOnScreen())) { 79 crossed = true; robot locates mouse pointer in the selected screen coordinates while e.getLocationOnScreen() returns pointer location in the combined virtual screen coordinates. "java/awt/Multiscreen/MultiScreenLocationTest/MultiScreenLocationTest.java" 70 Rectangle screen = gc.getBounds(); 71 Robot robot = new Robot(gd); 74 robot.mouseMove(screen.x + mouseOffset.x, screen.y + mouseOffset.y); robot.mouseMove() is incorrectly used because in this case the method accept the selected screen coordinates not the combined screen coordinates.