phamow / fest

Automatically exported from code.google.com/p/fest
0 stars 0 forks source link

Unable to press key combination and release them #284

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Let's suppose you have a framefixture and you want to press CTRL+S key
combination and after this combination was press in your application a
JFilleChooser (modal dialog) is opened. 

What is the expected output? What do you see instead?
The problem is that you can't release the keys because now your frame
fixture doesn't have the focus any more.

What version of the product are you using? On what operating system?
In version 0.8 this was possible. I'm using version 1.0 of fest.

Please provide any additional information below.
I think this is a major problem(blocking for me) and I can't upgrade my
code to swing-fest 1.0 because of this problem. I couldn't find any
workaround for this problem.
A small sample of code that now doesn't work any more:
void keyCombination(FrameFixture frame, int first, int second) {      
frame.pressKey(first).pressKey(second).releaseKey(second).releaseKey(first);
}

Original issue reported on code.google.com by nicus...@gmail.com on 19 Jan 2009 at 10:06

GoogleCodeExporter commented 9 years ago
Thanks for reporting this. I found it strange, since releaseKey simply releases 
the
given key code, regardless of who has the focus. Can you please provide a test 
case?
Without one, it would be difficult to reproduce the bug correctly.

You can use the method 'pressAndReleaseKey(KeyPressInfo)' on the meantime:

frame.pressAndReleaseKey(key(VK_S).modifiers(CTRL_MASK))

Thanks in advance,
-Alex

Original comment by Alex.Rui...@gmail.com on 21 Jan 2009 at 5:12

GoogleCodeExporter commented 9 years ago
I found a workaround to this problem: simply call robot.pressKey and 
robot.releaseKey.

I looked through the code and I saw that before you release a key first you 
check if
the component that calls releaseKey has the focus. I don't know if this is the 
right
behavior.

Original comment by nicus...@gmail.com on 21 Jan 2009 at 9:51

GoogleCodeExporter commented 9 years ago
It seems to be a bug in FEST. I'll investigate.

Many thanks!
-Alex

Original comment by Alex.Rui...@gmail.com on 22 Jan 2009 at 6:05

GoogleCodeExporter commented 9 years ago
I look into this bug, and it is really not a bug. The correct way to handle 
your case
is with either the workaround you found, or the one I provided.

Thanks,
-Alex

Original comment by Alex.Rui...@gmail.com on 9 Feb 2009 at 7:29