Reputation: 1407
I am writing a test in Codename One, in which I want to simulate click anywhere on the screen, since I want to check that a certain dialog is hidden. I tried to simulate the click using press and release:
form.pointerPressed(2, 2);
form.pointerReleased(2, 2);
But it did not work in the tests, nothing happened.
Upvotes: 2
Views: 134
Reputation: 1407
pointerPressed
and pointerReleased
, but not called on the form, but on the Display
, was the correct thing to do. I guess that the form I was trying to click was not accessible because of the blocking dialog.
Display.getInstance().pointerPressed(x, y);
Upvotes: 1
Reputation: 52770
There are many things that can cause that.
That specific dialog might not be dismissible with pointer out of bounds touch.
That point might be problematic for some reason e.g. might be in the status bar
The dialog might still be showing since the EDT needs to be flushed with callSerially
The code might not be reachable since the dialog blocked some execution due to invokeAndBlock
Upvotes: 0