|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.test.TouchUtils
public class TouchUtils
Reusable methods for generating touch events. These methods can be used with InstrumentationTestCase or ActivityTestCases to simulate user interaction with the application through a touch screen.
| Constructor Summary | |
|---|---|
TouchUtils()
|
|
| Method Summary | |
|---|---|
static void |
clickView(InstrumentationTestCase test,
View v)
Simulate touching the center of a view and releasing. |
static void |
drag(ActivityInstrumentationTestCase test,
float fromX,
float toX,
float fromY,
float toY,
int stepCount)
Simulate touching a specific location and dragging to a new location. |
static void |
dragQuarterScreenDown(ActivityInstrumentationTestCase test)
Simulate touching in the center of the screen and dragging one quarter of the way down |
static void |
dragQuarterScreenUp(ActivityInstrumentationTestCase test)
Simulate touching in the center of the screen and dragging one quarter of the way up |
static int |
dragViewBy(ActivityInstrumentationTestCase test,
View v,
int gravity,
int deltaX,
int deltaY)
Simulate touching a view and dragging it by the specified amount. |
static int |
dragViewTo(ActivityInstrumentationTestCase test,
View v,
int gravity,
int toX,
int toY)
Simulate touching a view and dragging it to a specified location. |
static void |
dragViewToBottom(ActivityInstrumentationTestCase test,
View v)
Simulate touching the center of a view and dragging to the bottom of the screen. |
static void |
dragViewToBottom(ActivityInstrumentationTestCase test,
View v,
int stepCount)
Simulate touching the center of a view and dragging to the bottom of the screen. |
static void |
dragViewToTop(ActivityInstrumentationTestCase test,
View v)
Simulate touching the center of a view and dragging to the top of the screen. |
static void |
dragViewToTop(ActivityInstrumentationTestCase test,
View v,
int stepCount)
Simulate touching the center of a view and dragging to the top of the screen. |
static int |
dragViewToX(ActivityInstrumentationTestCase test,
View v,
int gravity,
int toX)
Simulate touching a view and dragging it to a specified location. |
static int |
dragViewToY(ActivityInstrumentationTestCase test,
View v,
int gravity,
int toY)
Simulate touching a view and dragging it to a specified location. |
static void |
longClickView(ActivityInstrumentationTestCase test,
View v)
Simulate touching the center of a view, holding until it is a long press, and then releasing. |
static void |
scrollToBottom(ActivityInstrumentationTestCase test,
ViewGroup v)
Scroll a VirewGroup to the bottom by repeatedly calling dragQuarterScreenUp(ActivityInstrumentationTestCase) |
static void |
scrollToTop(ActivityInstrumentationTestCase test,
ViewGroup v)
Scroll a ViewGroup to the top by repeatedly calling dragQuarterScreenDown(ActivityInstrumentationTestCase) |
static void |
tapView(InstrumentationTestCase test,
View v)
Simulate touching the center of a view and releasing quickly (before the tap timeout). |
static void |
touchAndCancelView(InstrumentationTestCase test,
View v)
Simulate touching the center of a view and cancelling (so no on click should fire, etc). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TouchUtils()
| Method Detail |
|---|
public static void dragQuarterScreenDown(ActivityInstrumentationTestCase test)
test - The test cast that is being runpublic static void dragQuarterScreenUp(ActivityInstrumentationTestCase test)
test - The test cast that is being run
public static void scrollToBottom(ActivityInstrumentationTestCase test,
ViewGroup v)
dragQuarterScreenUp(ActivityInstrumentationTestCase)
test - The test cast that is being runv - The ViewGroup that should be dragged
public static void scrollToTop(ActivityInstrumentationTestCase test,
ViewGroup v)
dragQuarterScreenDown(ActivityInstrumentationTestCase)
test - The test cast that is being runv - The ViewGroup that should be dragged
public static void dragViewToBottom(ActivityInstrumentationTestCase test,
View v)
test - The test cast that is being runv - The view that should be dragged
public static void dragViewToBottom(ActivityInstrumentationTestCase test,
View v,
int stepCount)
test - The test cast that is being runv - The view that should be draggedstepCount - How many move steps to include in the drag
public static void tapView(InstrumentationTestCase test,
View v)
test - The test cast that is being runv - The view that should be clicked
public static void touchAndCancelView(InstrumentationTestCase test,
View v)
test - The test cast that is being runv - The view that should be clicked
public static void clickView(InstrumentationTestCase test,
View v)
test - The test cast that is being runv - The view that should be clicked
public static void longClickView(ActivityInstrumentationTestCase test,
View v)
test - The test cast that is being runv - The view that should be clicked
public static void dragViewToTop(ActivityInstrumentationTestCase test,
View v)
test - The test cast that is being runv - The view that should be dragged
public static void dragViewToTop(ActivityInstrumentationTestCase test,
View v,
int stepCount)
test - The test cast that is being runv - The view that should be draggedstepCount - How many move steps to include in the drag
public static int dragViewBy(ActivityInstrumentationTestCase test,
View v,
int gravity,
int deltaX,
int deltaY)
test - The test cast that is being runv - The view that should be draggedgravity - Which part of the view to use for the initial down event. A combination of
(TOP, CENTER_VERTICAL, BOTTOM) and (LEFT, CENTER_HORIZONTAL, RIGHT)deltaX - Amount to drag horizontally in pixelsdeltaY - Amount to drag vertically in pixels
public static int dragViewTo(ActivityInstrumentationTestCase test,
View v,
int gravity,
int toX,
int toY)
test - The test cast that is being runv - The view that should be draggedgravity - Which part of the view to use for the initial down event. A combination of
(TOP, CENTER_VERTICAL, BOTTOM) and (LEFT, CENTER_HORIZONTAL, RIGHT)toX - Final location of the view after draggingtoY - Final location of the view after dragging
public static int dragViewToX(ActivityInstrumentationTestCase test,
View v,
int gravity,
int toX)
test - The test cast that is being runv - The view that should be draggedgravity - Which part of the view to use for the initial down event. A combination of
(TOP, CENTER_VERTICAL, BOTTOM) and (LEFT, CENTER_HORIZONTAL, RIGHT)toX - Final location of the view after dragging
public static int dragViewToY(ActivityInstrumentationTestCase test,
View v,
int gravity,
int toY)
test - The test cast that is being runv - The view that should be draggedgravity - Which part of the view to use for the initial down event. A combination of
(TOP, CENTER_VERTICAL, BOTTOM) and (LEFT, CENTER_HORIZONTAL, RIGHT)toY - Final location of the view after dragging
public static void drag(ActivityInstrumentationTestCase test,
float fromX,
float toX,
float fromY,
float toY,
int stepCount)
test - The test cast that is being runfromX - X coordinate of the initial touch, in screen coordinatestoX - Xcoordinate of the drag destination, in screen coordinatesfromY - X coordinate of the initial touch, in screen coordinatestoY - Y coordinate of the drag destination, in screen coordinatesstepCount - How many move steps to include in the drag
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||