Hi,
If you look into waitForEvent impl, you'll see it assigns event field. I
agree it's not the best idea to relay on method's side effect. Some other
tests use Event event = waitForEvent(... to do the same check and it
looks clearer to me. But the test by itself seems valid.
Thanks.
Sergey.
On Mon, Apr 28, 2008 at 3:22 PM, Mackie Mathew <[EMAIL PROTECTED]> wrote:
> The testAction method that fails is due to:
>
> public final void testAction() {
> int eventId = Event.ACTION_EVENT;
> myTestComp = new MyButton();
> createFrameAndWait();
> robot.setAutoDelay(700);
> Point screenLoc = myTestComp.getLocationOnScreen();
> int centerX = myTestComp.getWidth() / 2;
> int centerY = myTestComp.getHeight() / 2;
> screenLoc.translate(centerX, centerY);
> final Point absPos = screenLoc;
>
> waitForEvent(new Runnable() {
> public void run() {
> robot.mouseMove(absPos.x, absPos.y);
> robot.mousePress(InputEvent.BUTTON1_MASK |
> InputEvent.BUTTON2_MASK);
> robot.mouseRelease(InputEvent.BUTTON1_MASK |
> InputEvent.BUTTON2_MASK);
> }
> }, eventId, waitTime);
> * assertNotNull(event);*
> Event actionEvt = new Event(myTestComp, eventId,
> ((Button) myTestComp).getLabel());
> actionEvt.modifiers = Event.ALT_MASK;
> checkOldEvent(actionEvt);
> }
>
>
> The private variable event is declared to null at setUp() and it is not
> changed and checked for not being null. I do not understand the logic
> behind
> this. Shouldn't the test obviously fail as event is not assigned a not
> null
> value.
>
> --
> Regards,
>
> Tharindu
>