harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Salishev" <sergey.i.salis...@gmail.com>
Subject Re: [harmony-demo-1] Reasons for java.awt.ComponentTest failure
Date Mon, 28 Apr 2008 18:02:18 GMT
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 <mccloud35@gmail.com> 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
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message