renatoathaydes / Automaton

Simple framework which allows the testing of Swing and JavaFX2 applications.
Apache License 2.0
99 stars 20 forks source link

Robot does not work in Mac #19

Closed renatoathaydes closed 8 years ago

renatoathaydes commented 10 years ago

Fixed the Robot, but in Mac other problems still occur related to MouseInfo.

hastebrot commented 10 years ago

Hi Renato!

What were the problems related to java.awt.MouseInfo?

Update: Seems the problem was this:

java[1129:707] [JRSAppKitAWT markAppIsDaemon]: Process manager already initialized: can't fully enable headless mode.
renatoathaydes commented 10 years ago

Hello!

Not sure if that was the only problem, people using Mac say it's not working.... I have the same issue as you, no Macs easily available to test :) My girlfriend just bought one, though, so I might steal it from her and try to work around this issue one day!

hastebrot commented 10 years ago

With https://github.com/TestFX/TestFX/pull/126 the test suite of TestFX passed nearly all tests on OSX (tested with JDK 1.7.0_60 and 1.8.0_05 on OSX 10.8). It only failed the tests with different OS-specific user inputs. So it seems to work now, but I'm not quite sure if it works on all circumstances.

The important change was to set javafx.macosx.embedded.

System.setProperty("javafx.macosx.embedded", "true");
Application.launch(appClass, appArgs);

The current code creates a new java.awt.Robot and then can call Application.launch() and retrieve the primary Stage.

It can also call

renatoathaydes commented 10 years ago

Thank you for the information... I wonder why Oracle would require this system property to be set to true to let things work!

hastebrot commented 10 years ago

Seems that Glass was not able to detect this automatically in OSX before Java 1.8 (Lombard) [1].

[1] https://javafx-jira.kenai.com/browse/RT-27218

renatoathaydes commented 10 years ago

Could anyone try Automaton 1.1.0, which I just released, in Mac and see if it works, please?

http://jcenter.bintray.com/com/athaydes/automaton/Automaton/

Would really appreciate, thanks.

renatoathaydes commented 8 years ago

Don't know when or how.. but automaton is working fine in Mac with current versions.