I am trying to create a RAP application that needs to move the cursor pointer to a certain position during a game.
Is there a way, using SWT, to move the cursor position? Obviously the java.awt.Robot().mouseMove
is not valid in this case because it uses AWT.
RAP does not support changing the cursor location.
Display::getCursorLocation
allows to query the (last known) cursor location, but there setCursorLocation
, which is available in SWT is not implemented by RAP.
Even if there was an API server-side, I doubt that the client security policy would allow to mess the mouse pointer position.
In my experience it is best to separate the UI from the rest of your application code so that the UI layer becomes so thin that it is safe enough to go without automated tests.
Another way to test SWT or RAP UIs is to expose the relevant widgets to the test code and use Widget::notifyListeners
to simulate user interaction. Again this works best if your application logic is cleanly separated and can be replaced with tests doubles while testing.