Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Generating SWT.Arm events with SWTbot?
Generating SWT.Arm events with SWTbot? [message #34103] Tue, 28 April 2009 14:37 Go to next message
No real name is currently offline No real nameFriend
Messages: 2
Registered: July 2009
Junior Member
Is it possible to make SWTbot generate SWT.Arm events on a context menu?

In the application I am working on, we have a view that extends the Common
Navigator Framework. We use a CommonActionProvider to add context menus to
certain elements in the view.

We've "attached" tooltips to the MenuItems in the context menu following
the general pattern described here:
http://dev.eclipse.org/newslists/news.eclipse.platform.swt/m sg35542.html.
We use a show listener to add an arm listener to each MenuItem, and the
arm listener is what displays the tooltip.

I tried to write a SWTbot test that verifies that the tooltip shows the
correct text, but I discovered that SWTbot does not appear to generate the
SWT.Arm events necessary to get the tooltip to show.

I am using Eclipse 3.3.2, and SWTBot 2 (build 110.) I am able to trigger
the context menu with code like this:
SWTBotMenu contextMenu = myTreeItem.contextMenu("Menu");
contextMenu.menu("Submenu1").click();
but the widgetArmed() event in the ArmListener I register never gets
called when the SWTbot test runs.

Is it possible to generate these events with the 110 build of SWTbot, or
do wI need to get a newer version?
Re: Generating SWT.Arm events with SWTbot? [message #34171 is a reply to message #34103] Fri, 01 May 2009 03:58 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
Hi Thomas,

Arm events is not supported on SWTBot. Please open a bug with a sample
of how you'd like the SWTBot api that deals with arm events to look like.

As a workaround, you can invoke the event on the widget directly as well:

menuItem = bot.contextMenu("foo").widget;

syncExec(new VoidResult(){
void run(){
widget.notifyListeners(SWT.Arm, null);
}
}

-- Ketan

On 28/4/09 20:07, Thomas Hanselman wrote:
> Is it possible to make SWTbot generate SWT.Arm events on a context menu?
>
> In the application I am working on, we have a view that extends the
> Common Navigator Framework. We use a CommonActionProvider to add context
> menus to certain elements in the view.
>
> We've "attached" tooltips to the MenuItems in the context menu following
> the general pattern described here:
> http://dev.eclipse.org/newslists/news.eclipse.platform.swt/m sg35542.html. We
> use a show listener to add an arm listener to each MenuItem, and the arm
> listener is what displays the tooltip.
>
> I tried to write a SWTbot test that verifies that the tooltip shows the
> correct text, but I discovered that SWTbot does not appear to generate
> the SWT.Arm events necessary to get the tooltip to show.
> I am using Eclipse 3.3.2, and SWTBot 2 (build 110.) I am able to trigger
> the context menu with code like this:
> SWTBotMenu contextMenu = myTreeItem.contextMenu("Menu");
> contextMenu.menu("Submenu1").click();
> but the widgetArmed() event in the ArmListener I register never gets
> called when the SWTbot test runs.
>
> Is it possible to generate these events with the 110 build of SWTbot, or
> do wI need to get a newer version?
Re: Generating SWT.Arm events with SWTbot? [message #34435 is a reply to message #34171] Mon, 04 May 2009 15:49 Go to previous message
No real name is currently offline No real nameFriend
Messages: 2
Registered: July 2009
Junior Member
Thanks for the help! That gives me some ideas on how we can automate some
of our other tests as well.

As for an API to trigger the arm events -- my initial thought would be
that they would be something that would be triggered automatically. Is it
possible for a user to invoke a menu item by navigating to it with the
mouse or keyboard without having an arm event generated? If it isn't
possible, then it would make sense to have the event generated
automatically as part of a SWTbot setFocus() call or something.
Previous Topic:Off action for a while...
Next Topic:macosx experiences
Goto Forum:
  


Current Time: Tue Dec 23 05:26:37 GMT 2014

Powered by FUDForum. Page generated in 1.89891 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software