Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » 'Click' at given coordinates inside a RCP View
'Click' at given coordinates inside a RCP View [message #990016] Mon, 10 December 2012 13:53 Go to next message
Bernard SARTER is currently offline Bernard SARTER
Messages: 76
Registered: August 2011
Location: Paris, France
Member
Hello,

I'm fully new to SWTBot, so sorry in case my question is too 'simple' ...

I have an Eclipse RCP app, and I have a view 'V', inside a perspective 'P'.

This view mainly displays a fixed background image, and reacts if the user clicks at some given places, by checking the coordinates passed through the mouseDown method.

I'd like to write a test for that, using SWTBot, but I don't know how I could send a 'click' event directly at some coordinate X,Y of my view.

Any suggestions welcome ...

Thanks & best regards,
Bernard.
Re: 'Click' at given coordinates inside a RCP View [message #990192 is a reply to message #990016] Tue, 11 December 2012 10:55 Go to previous message
Mickael Istria is currently offline Mickael Istria
Messages: 764
Registered: July 2009
Location: Grenoble, France
Senior Member
On 12/10/2012 02:53 PM, Bernard SARTER wrote:
> Hello,

Hi,

> This view mainly displays a fixed background image, and reacts if the
> user clicks at some given places, by checking the coordinates passed
> through the mouseDown method.
>
> I'd like to write a test for that, using SWTBot, but I don't know how I
> could send a 'click' event directly at some coordinate X,Y of my view.

This is quite a low-level operation. SWTBot is good at manipulating SWT
and Eclipse widgets and concepts.
I think the best way to achieve what you want is directly to send an SWT
Event to this Image.

Display.asynExec(new Runnable() {
void run() {
widget.notifyListener(new Event(SWT.MouseDown...);
widget.notifyListener(new Event(SWT.MouseUp...);
}
}

HTH


--
Mickael Istria
JBoss, by Red Hat
My blog: http://mickaelistria.wordpress.com
My Tweets: http://twitter.com/mickaelistria
Previous Topic:Widgets on CTabItem
Next Topic:Running SWTBot with RCP4.2
Goto Forum:
  


Current Time: Tue Sep 30 16:08:07 GMT 2014

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

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