|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.extensions.jfcunit.TestHelper
junit.extensions.jfcunit.RobotTestHelper
Class that provides facilities for locating components within a GUI. To use create a new instance of RobotTestHelper in your setUp. Windows can only be located once they have been shown once to the user. After calling the helper.enterClickAndLeave() the JFCTestCase.sleep(long delay) method should be called to prevent subsequent clicks from being treated as a double click. A sleep dalay of 300ms can be used as a guideline.
Field Summary | |
private static int |
LEGAL_BUTTONS
Legal buttons. |
private int |
m_delay
Mandatory delay to get thing working. |
private java.awt.Robot |
m_robot
Robot instance. |
private static java.awt.Point |
s_last
Last location. |
Fields inherited from class junit.extensions.jfcunit.TestHelper |
DEFAULTSLEEP |
Constructor Summary | |
RobotTestHelper()
Construct a new RobotTestHelper. |
Method Summary | |
protected void |
keyPressed(java.awt.Component ultimate,
JFCKeyStroke stroke)
Process a key press event on a component. |
protected void |
keyReleased(java.awt.Component ultimate,
JFCKeyStroke stroke)
Process a key release event on a component. |
protected void |
mouseMoved(java.awt.Component ultimate,
int x,
int y)
Process a mouse move event on a component. |
protected void |
mousePressed(java.awt.Component ultimate,
int modifiers,
int click,
boolean isPopupTrigger)
Process a mouse press event on a component. |
protected void |
mouseReleased(java.awt.Component ultimate,
int modifiers,
int click,
boolean isPopupTrigger)
Process a mouse release event on a component. |
protected void |
mouseWheel(java.awt.Component ultimate,
int amount,
int wheelRotation)
Simulate rotating the mouseWheel. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static java.awt.Point s_last
private static final int LEGAL_BUTTONS
private java.awt.Robot m_robot
private int m_delay
Constructor Detail |
public RobotTestHelper() throws java.awt.AWTException
java.awt.AWTException
- An instance of java.awt.AWTException can be thrown
when initializing the Robot.Method Detail |
protected void keyPressed(java.awt.Component ultimate, JFCKeyStroke stroke)
keyPressed
in class TestHelper
ultimate
- Not used in the robot.stroke
- The JFCKeyStroke to be performed.protected void keyReleased(java.awt.Component ultimate, JFCKeyStroke stroke)
keyReleased
in class TestHelper
ultimate
- Not used in the robot.stroke
- The JFCKeyStroke to be performed.protected void mouseMoved(java.awt.Component ultimate, int x, int y)
mouseMoved
in class TestHelper
ultimate
- Not used in the robot.x
- The x coordinate of the point where the mouse is being moved to.y
- The y coordinate of the point where the mouse is being moved to.protected void mousePressed(java.awt.Component ultimate, int modifiers, int click, boolean isPopupTrigger)
mousePressed
in class TestHelper
ultimate
- Not used in the robot.modifiers
- The modifiers associated with this mouse event.click
- The number of clicks associated with this mouse event.isPopupTrigger
- Whether this mouse event will generate a popup.protected void mouseReleased(java.awt.Component ultimate, int modifiers, int click, boolean isPopupTrigger)
mouseReleased
in class TestHelper
ultimate
- Not used in the robot.modifiers
- The modifiers associated with this mouse event.click
- The number of clicks associated with this mouse event.isPopupTrigger
- Whether this mouse event will generate a popup.protected void mouseWheel(java.awt.Component ultimate, int amount, int wheelRotation)
mouseWheel
in class TestHelper
ultimate
- Component to fire the events on.amount
- Amount to rotate the wheel. Ignored on the robot.
The amount will be extracted from the OS Mouse configuration.wheelRotation
- Rotation of the mouse wheel.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |