Hi, I am new to JFCUnit.
Excuse me if it earlier known behavior but I found that
getHelper().sendKeyAction(new KeyEventData(this,
txtLogin, KeyEvent.VK_A,
InputEvent.CTRL_DOWN_MASK, 0));
works fine with JFCTestHelper and does not work with
RobotTestHelper (JFCUnit sends Ctrl and 'a' separately in
this case I think, 'a' appears in text field only, no text
selection happens)
JDK1.4.1_02
JDK1.5.0-b64
on Windows 2000 SP4
Logged In: YES
user_id=499057
I found workaround! Maybe it would be helpfull...
RobotTestHelper.java:
protected void keyPressed(final Component ultimate,
final JFCKeyStroke stroke) {
m_robot.delay(m_delay);
m_robot.keyPress(stroke.getKeyCode());
}
protected void keyReleased(final Component ultimate,
final JFCKeyStroke stroke) {
m_robot.delay(m_delay);
m_robot.keyRelease(stroke.getKeyCode());
}
change to:
protected void keyPressed(final Component ultimate,
final JFCKeyStroke stroke) {
m_robot.delay(m_delay);
int modifiers = stroke.getModifiers();
if ((modifiers & InputEvent.CTRL_MASK) != 0)
m_robot.keyPress(KeyEvent.VK_CONTROL);
// other modifiers
m_robot.delay(m_delay); // (?)
m_robot.keyPress(stroke.getKeyCode());
}
protected void keyReleased(final Component ultimate,
final JFCKeyStroke stroke) {
m_robot.delay(m_delay);
m_robot.keyRelease(stroke.getKeyCode());
m_robot.delay(m_delay); // (?)
int modifiers = stroke.getModifiers();
if ((modifiers & InputEvent.CTRL_MASK) != 0)
m_robot.keyRelease(KeyEvent.VK_CONTROL);
// other modifiers in reversed order
}
It works!