public interface KeyboardInputSimulationFixture
Modifier and Type | Method and Description |
---|---|
KeyboardInputSimulationFixture |
pressAndReleaseKey(KeyPressInfo keyPressInfo)
Simulates a user pressing given key with the given modifiers on this fixture's GUI component.
|
KeyboardInputSimulationFixture |
pressAndReleaseKeys(int... keyCodes)
Simulates a user pressing and releasing the given keys on this fixture's GUI component.
|
KeyboardInputSimulationFixture |
pressKey(int keyCode)
Simulates a user pressing given key on this fixture's GUI component.
|
KeyboardInputSimulationFixture |
releaseKey(int keyCode)
Simulates a user releasing the given key on this fixture's GUI component.
|
KeyboardInputSimulationFixture pressAndReleaseKeys(int... keyCodes)
keyCodes
- one or more codes of the keys to press.NullPointerException
- if the given array of codes is null
.IllegalArgumentException
- if any of the given code is not a valid key code.IllegalStateException
- if the component is disabled.IllegalStateException
- if the component is not showing on the screen.KeyEvent
KeyboardInputSimulationFixture pressKey(int keyCode)
keyCode
- the code of the key to press.IllegalArgumentException
- if the given code is not a valid key code.IllegalStateException
- if the component is disabled.IllegalStateException
- if the component is not showing on the screen.KeyEvent
KeyboardInputSimulationFixture pressAndReleaseKey(KeyPressInfo keyPressInfo)
InputEvent
masks.
The following code listing shows how to press 'CTRL' + 'C' in a platform-safe way:
JTextComponentFixture textBox = dialog.textBox("username"); textBox.selectAll() .pressAndReleaseKey(key().modifiers(
VK_C
controlOrCommandMask
()));
keyPressInfo
- specifies the key and modifiers to press.NullPointerException
- if the given KeyPressInfo
is null
.IllegalArgumentException
- if the given code is not a valid key code.IllegalStateException
- if the component is disabled.IllegalStateException
- if the component is not showing on the screen.KeyboardInputSimulationFixture releaseKey(int keyCode)
keyCode
- the code of the key to release.IllegalArgumentException
- if the given code is not a valid key code.IllegalStateException
- if the component is disabled.IllegalStateException
- if the component is not showing on the screen.KeyEvent
Copyright © 2007-2013 FEST (Fixtures for Easy Software Testing). All Rights Reserved.