Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » [SWTBotTest] How to retrieve/check exists of a context menu
[SWTBotTest] How to retrieve/check exists of a context menu [message #1597141] Mon, 02 February 2015 04:56 Go to next message
Huy Le is currently offline Huy LeFriend
Messages: 18
Registered: November 2014
Junior Member
Hello,

I wrote a test to check an context menu not available as expected.

I've found no api support it. What i can do is using try..catch(WidgetNotFoundException) which is not a good solution since it take time till timeout happen, increase test time execution.

Do we have better answer for the issue?

Thanks.

Thanh Huy LE

[Updated on: Mon, 02 February 2015 05:57]

Report message to a moderator

Re: [SWTBotTest] How to retrieve/check exists of a context menu [message #1602484 is a reply to message #1597141] Thu, 05 February 2015 15:45 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 470
Registered: May 2011
Senior Member
Hello,

I think that you could do that by modifying a little the service
SWTBotUtils.hasContextMenu(...).
In this service there is a call to swtBotContextMenu.exist(). This one
has a waiting condition on the menu item, that execute this test:
items.addAll(menuFinder.findMenus(matcher));
return !items.isEmpty();
You can try to have the same test but without the waiting condition.

Regards,
Steve


Le 02/02/2015 05:56, Huy Le a écrit :
> Hello,
>
> I wrote a test to check an context menu not available as expected.
>
> I've found any api support it. What i can do is using
> try..catch(WidgetNotFoundException) which is not a good solution since
> it take time till timeout happen, increase test time execution.
>
> Do we have better answer for the issue?
>
> Thanks.
>
> Thanh Huy LE


--
Steve Monnier - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius


Steve Monnier - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: [SWTBotTest] How to retrieve/check exists of a context menu [message #1607974 is a reply to message #1602484] Mon, 09 February 2015 07:24 Go to previous messageGo to next message
Huy Le is currently offline Huy LeFriend
Messages: 18
Registered: November 2014
Junior Member
Thanks,

However, SWTBotUtils.hasContextMenu() applied to TreeItem. The method requires two objects: Display and Control where we can retrieve them by call treeItem.display and treeItem.widget.getParent()

How can we do same thing via SWTBotGefEditor when a node selected?

As I know, editor.getWidget().getDisplay() return Display. What proper method return the Control?

(I expect editor.getSWTBotGefViewer().getControl() but the method is protected)

Thanh Huy LE





Re: [SWTBotTest] How to retrieve/check exists of a context menu [message #1610020 is a reply to message #1607974] Tue, 10 February 2015 13:51 Go to previous message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 470
Registered: May 2011
Senior Member
Hello,

To access the Control using the SWTBotGetEditor, you need to recover the
EditPart of the Diagram and then its viewer. Therefore you should use
the following expression:
editor.getDiagramEditPart().getViewer().getControl().

Regards,
Steve

Le 09/02/2015 08:24, Huy Le a écrit :
> Thanks,
>
> However, SWTBotUtils.hasContextMenu() applied to TreeItem. The method
> requires two objects: Display and Control where we can retrieve them by
> call treeItem.display and treeItem.widget.getParent()
>
> How can we do same thing via SWTBotGefEditor when a node selected?
> As I know, editor.getWidget().getDisplay() return Display. What proper
> method return the Control?
>
> (I expect editor.getSWTBotGefViewer().getControl() but the method is
> protected)
>
> Thanh Huy LE
>
>
>
>
>
>


--
Steve Monnier - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius


Steve Monnier - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Navigate Different Metamodels
Next Topic:Disable vertical reordering of executions nodes in Sequence diagram representations
Goto Forum:
  


Current Time: Mon Mar 30 14:56:23 GMT 2020

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

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

Back to the top