assertj-swing icon indicating copy to clipboard operation
assertj-swing copied to clipboard

AssertJ still doesn't work with dual monitor and primary monitor to the right

Open gorbeia opened this issue 9 years ago • 8 comments

I think this may be a duplicate of #98. Still I have updated to version 2.1.0 but the tests are still failing in a dual monitor setup where the main monitor is to the right.

I have created a Junit test that runs when the main monitor is to the left and fails when the main monitor is to the right: https://gist.github.com/gorbeia/60e7c6039cd2e8592243.

gorbeia avatar Jul 02 '15 07:07 gorbeia

Thank you for opening that issue and contributing a test.

Unfortunately for me the test works on both of my working machines. One is running xfce4-wm and the other is running standard Ubuntu with compiz.

The test neither fails if I switch the monitors. Unfortunately there is no option to say let the right monitor be the main monitor.

Which OS do you use? And if not Windows, which window manager?

As it may take a good while till I'll have time to try reproducing the problem on several machines I would suggest that you try analyzing the problem and contribute a fix. That would be really kind!

You can have a look at https://github.com/joel-costigliola/assertj-swing/issues/98#issuecomment-110024441 to get a start where to look at the code.

Also you can try to apply the patch for AWT class.

croesch avatar Jul 08 '15 09:07 croesch

I forgot to mention that the error is happening in Windows 7.

gorbeia avatar Jul 08 '15 19:07 gorbeia

@croesch Did you try this setting on Windows 7?

2015_07_15_16_18_54_systemsteuerung_alle_systemsteuerungselemente_anzeige_bildschirmauflosung

As far as I can see the robot becomes created for the left screen instead of the primary screen in WindowStatus, now: - r = robotFactory.newRobotInPrimaryScreen(); + r = robotFactory.newRobotInLeftScreen();

PAX523 avatar Jul 15 '15 14:07 PAX523

Thanks @gorbeia that's an important information :)

@PAX523 unfortunately I did test #98 just under Linux. I might just revert the commit on #98 and see if it works under Windows 7 as expected. Then compare the coordinate system of the robot with the one created under Linux in both cases.

Just to make sure, does the Java version have any effect?

croesch avatar Jul 15 '15 14:07 croesch

The test fails on Java 7. It opens the window in the right main screen and tries to click in the left screen.

It works fine on Java 8. It opens the window in the right main screen and clicks in the same screen.

gorbeia avatar Jul 27 '15 07:07 gorbeia

Thanks @gorbeia! So if you use Java 8 everything works as expected?

croesch avatar Oct 05 '15 08:10 croesch

With jre1.8.0_11_x64 I'm still faced with the same issue. @gorbeia Which exact version of Java did you use?

PAX523 avatar Oct 05 '15 09:10 PAX523

Just wanted to chime in and say I'm experiencing the same problem. I'm running Windows 7, jdk1.8.0_05 (x64) and running JUnit tests from Eclipse Luna. When my left monitor is set as the primary the tests run fine. When the right monitor is the primary they fail. The cursor will automatically move over to the center of the left monitor, then jump up to the top of the monitor.

mmlinford avatar Nov 25 '15 23:11 mmlinford