| sync after AbstractSWTBot#pressShortcut() ? [message #991437] |
Wed, 19 December 2012 02:29  |
Knut Wannheden Messages: 283 Registered: July 2009 |
Senior Member |
|
|
Hi all,
The way I understand it the SWTKeyboardStrategy will post the key events
asynchronously and since Display#post() doesn't even have to be called
by the UI thread, this isn't done using Display#syncExec() or
Display#asyncExec() (unlike AbstractSWTBot#mouseMove() which calls
Display#post() using Display#asyncExec()).
This all works fine, but it would often be convenient if it were known
that after the call to AbstractSWTBot#pressShortcut() returns, the event
has been positively processed by the SWT event queue. We've been doing
that by calling Display#syncExec() (or actually
UiThreadRunnable#syncExec()) with a no-op.
Has anyone else come across this need? I think it would have been nice
if AbstractSWTBot#pressShortcut() would do that itself. But I am no
expert, so I am wondering if there are good reasons against doing that.
Regards,
--knut
|
|
|
|
| Re: sync after AbstractSWTBot#pressShortcut() ? [message #991455 is a reply to message #991447] |
Wed, 19 December 2012 03:57  |
Knut Wannheden Messages: 283 Registered: July 2009 |
Senior Member |
|
|
Hi Mickael,
What you describe sounds like much more than I was asking about. It is
really just AbstractSWTBot#pressShortcut() I am concerned about. After
that method has been called (e.g. with 'Ctrl+m' to maximize a view) I
often need to wait until the SWT event thread has processed the event
(i.e. actually maximized the view) until I can continue with the test.
We have had some instability with some of our tests which we suspect may
be due to this fact.
Isn't it for similar reasons that AbstractSWTBot#notify() does exactly
this (i.e. runs a no-op using Display#syncExec()) at the end?
Regards,
--knut
On 12/19/12 9:30 AM, Mickael Istria wrote:
> I think it's an interesting idea.
> You'd like to have a way to invoke SWTBot methods in a synchronous way.
> This would require an important refactoring in SWTBot: methods should
> only create the events or Runnable, and then a processor would run it,
> synchronously or asynchronously depending on a configuration for the bot.
> Feel free to open a bug to request this, and to write some code if you
> have time ;) http://wiki.eclipse.org/SWTBot/Contributing
> SWTBot has a huge TestSuite, so there is no big risk in refactoring. If
> something is broken, we'll most likely notice it.
>
> Cheers,
>
|
|
|
Powered by
FUDForum. Page generated in 0.01890 seconds