Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » typeText switching shells(typeText switches shells during debug)
typeText switching shells [message #493551] Mon, 26 October 2009 15:20 Go to next message
Jay Norwood is currently offline Jay Norwood
Messages: 112
Registered: July 2009
Senior Member
Has anyone else encountered a problem with typeText switching shells? I've had the problem a couple of times were I was clicking in another shell while the swtbot test was running, and suddenly that shell started receiving the entry from the typeText calls. Shouldn't typeText be setting focus to the test case's last focus prior to type of each character?

Re: typeText switching shells [message #493602 is a reply to message #493551] Tue, 27 October 2009 04:15 Go to previous messageGo to next message
Kay-Uwe Graw is currently offline Kay-Uwe Graw
Messages: 24
Registered: July 2009
Junior Member
swtbot is always looking for the controls in the active shell. If you activate a different shell manually during a test run the swtbot test will certainly fail.
Re: typeText switching shells [message #494468 is a reply to message #493602] Fri, 30 October 2009 14:43 Go to previous messageGo to next message
Jay Norwood is currently offline Jay Norwood
Messages: 112
Registered: July 2009
Senior Member
There seems to be some big difference in the susceptibility of typeText vs setText in this regard. I've never seen the problem with setText text ending up in a different shell. I suspect this is some flaw unique to typeText, maybe a result of the sleeps inserted between characters, where it is allowing some other shell to grab focus during and not restoring focus to the targeted widget at the start of each typed character.
Re: typeText switching shells [message #494477 is a reply to message #494468] Fri, 30 October 2009 15:30 Go to previous message
Pascal G is currently offline Pascal G
Messages: 157
Registered: July 2009
Senior Member
Jay Norwood wrote:
> There seems to be some big difference in the susceptibility of typeText
> vs setText in this regard. I've never seen the problem with setText
> text ending up in a different shell. I suspect this is some flaw unique
> to typeText, maybe a result of the sleeps inserted between characters,
> where it is allowing some other shell to grab focus during and not
> restoring focus to the targeted widget at the start of each typed
> character.

typeText generates low level key event (unless you use the
MockKeyboardStrategy). These event are then routed to the active
(focused) widget by SWT. It is intended to mimic someone typing on a
keyboard; so if you change the focus while he types, the text will end
on the new widget.
On the other hand, setText directly sets the text attribute of the
widget; it's the same as calling Text.setText(String). Doing this, no
events are fired (such as KeyPress or Modify).

--
Pascal GĂ©linas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Previous Topic:addition to locate arrow buttons
Next Topic:Git Repo Out Of Date
Goto Forum:
  


Current Time: Fri Aug 29 12:27:32 EDT 2014

Powered by FUDForum. Page generated in 0.02004 seconds