public interface IMouseActionInfo
IMouseActionInfo
is passed into the proxy's processMouseEvent
method
during recording. There are two primary types of mouse action: a
hover or an nClickDrag. A hover is simple; the mouse
hovers over an object for a certain amount of time. These are
only recorded when the user hits the shift key and releases it with
without pressing any other key. The proxy's processMouseEvent
method
is only called once for a hover action.
The nClickDrag action covers the methods click, drag, doubleClick, nClick
and nClickDrag.
The action always begins with a mouse down event. If the object disappears because of the down event, no other events are combined into the action recording. More commonly, the action also includes a mouse up event. If the mouse up is at the same location as the mouse down, the action is a click. If the mouse up is over a different object, or if the coordinates are sufficiently far away from the coordinates for the mouse down, the action is a drag. A doubleClick occurs if the mouse is clicked down, up, down and up again at the same location within a specified time period. A doubleclick is the same as an nClick(2). An nClickDrag can combine multiple down/up pairs culminating with a down, some mouse moves, and a mouse up at a different location.
For Java, drags are commonly recorded, because even a mouse move of a single pixel is considered to be a drag. Other domains are more foregiving; they consider a amount of movement within a click.
For an nClickDrag, the proxy's processMouseEvent
method is called before
each mouse event and one final time after the last event. For example, during
the recording of a click action, processMouseEvent
is called before the mouse down
is sent to the SUT (eventState = PRE_DOWN), before the mouse up is sent to the
SUT (eventState = PRE_UP) and one final time after a delay (eventState = POST_UP).
The POST_UP event is useful for action recordings that pay attention to state changes
in the SUT.
Modifier and Type | Field and Description |
---|---|
static int |
HOVER
Indicates that the mouse is hovering over
an object.
|
static int |
POST_UP
Indicates that the mouse
has gone up.
|
static int |
PRE_DOWN
Indicates that the mouse
is about to go down.
|
static int |
PRE_UP
Indicates that the mouse
is about to go up.
|
Modifier and Type | Method and Description |
---|---|
MethodSpecification |
getActionMethodSpecification()
Gets the
MethodSpecification for the action. |
int |
getCachedRectX()
Returns the cached x-coordinate of left edge of the
window containing the mouse-down event.
|
int |
getCachedRectY()
Returns the cached x-coordinate of the top edge of the
window containing the mouse-down event.
|
int |
getClickCount()
Returns the number of clicks in the action.
|
MethodSpecification |
getDropPointMethodSpecification()
Returns the
MethodSpecification for a method that
returns the target point. |
int |
getEventCount()
Returns the number of mouse events that make up this action.
|
IMouseEventInfo |
getEventInfo(int index)
Returns an
IMouseEventInfo for a particular event in the action. |
int |
getEventState()
Returns the current event state.
|
int |
getMouseEventFilter()
Returns the flags for the events that will not be processed by proxies for
this mouseAction to not call proxies for certain events (PRE_UP or
POST_UP).
|
boolean |
isDrag()
Determines whether the action is a mouse drag.
|
void |
setActionMethodSpecification(MethodSpecification ms)
Sets the
MethodSpecification for the action. |
void |
setCachedRectX(int x)
Sets the cached x-coordinate of the left edge of the
window containing the mouse-down event.
|
void |
setCachedRectY(int y)
Sets the cached y-coordinate of the top edge of the
window containing the mouse-down event.
|
void |
setMouseEventFilter(int eventsToFilter)
Tells the recorder to not call proxies for certain events (PRE_UP or
POST_UP).
|
static final int PRE_DOWN
static final int PRE_UP
static final int POST_UP
processMouseEvent()
for POST_UP so that the application under test
has a chance to react to the mouse button up event. Note that the application can possibly
no longer be running. In this case, the recorder cannot process the event.static final int HOVER
int getEventState()
int getEventCount()
IMouseEventInfo getEventInfo(int index)
IMouseEventInfo
for a particular event in the action.boolean isDrag()
int getClickCount()
int getCachedRectX()
void setCachedRectX(int x)
int getCachedRectY()
void setCachedRectY(int y)
MethodSpecification getDropPointMethodSpecification()
MethodSpecification
for a method that
returns the target point.
This drop point is usually defined for actions that return true for
isDrag
. However, if a different object appears at the same mouse coordinate
between the mouse down and the mouse up, this drop point is defined for a mouse click
action that is not a drag.
void setActionMethodSpecification(MethodSpecification ms)
MethodSpecification
for the action.MethodSpecification getActionMethodSpecification()
MethodSpecification
for the action.void setMouseEventFilter(int eventsToFilter)
The reason for this filter is that, under certain circumstances, communication with the SUT does not happen, and attempting to make it happen will cause unpleasant timeouts. By suppressing the normal processing of these events, the timeouts are avoided.
The event filtering can have an unfortunate effect if not used carefully. For example, when clicking on the close button on a browser window, we find that the windows implementation prevents switching into the UI thread for the PRE_UP event. Consequently, PRE_UP is suppressed. If the POST_UP were also suppressed, we would only see the PRE_DOWN event for the action would be apparent. Consequently, it would be impossible to distinguish between a proper click() and a drag() off the close button. However, the click() causes the app to exit, and the drag would have no effect. Properly, the proxy should process the mouse up event in the POST_UP and distinguish between the two cases.
Note that suppressing the POST_UP event can improve performance slightly. Therefore, if a proxy does not process the POST_UP, it may set the filter for this event.
int getMouseEventFilter()