java.lang.Object | |
↳ | android.test.TouchUtils |
Reusable methods for generating touch events. These methods can be used with InstrumentationTestCase or ActivityInstrumentationTestCase2 to simulate user interaction with the application through a touch screen.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Simulate touching the center of a view and releasing.
| |||||||||||
Simulate touching a specific location and dragging to a new location.
| |||||||||||
This method is deprecated.
ActivityInstrumentationTestCase is deprecated in favor of
ActivityInstrumentationTestCase2, which provides more options for
configuring the Activity under test
| |||||||||||
Simulate touching in the center of the screen and dragging one quarter of the way down
| |||||||||||
This method is deprecated.
ActivityInstrumentationTestCase is deprecated in favor of
ActivityInstrumentationTestCase2, which provides more options for
configuring the Activity under test
| |||||||||||
Simulate touching in the center of the screen and dragging one quarter of the way up
| |||||||||||
This method is deprecated.
ActivityInstrumentationTestCase is deprecated in favor of
ActivityInstrumentationTestCase2, which provides more options for
configuring the Activity under test
| |||||||||||
This method is deprecated.
ActivityInstrumentationTestCase is deprecated in favor of
ActivityInstrumentationTestCase2, which provides more options for
configuring the Activity under test
| |||||||||||
This method is deprecated.
ActivityInstrumentationTestCase is deprecated in favor of
ActivityInstrumentationTestCase2, which provides more options for
configuring the Activity under test
| |||||||||||
This method is deprecated.
ActivityInstrumentationTestCase is deprecated in favor of
ActivityInstrumentationTestCase2, which provides more options for
configuring the Activity under test
| |||||||||||
Simulate touching a view and dragging it to a specified location.
| |||||||||||
Simulate touching the center of a view and dragging to the bottom of the screen.
| |||||||||||
This method is deprecated.
ActivityInstrumentationTestCase is deprecated in favor of
ActivityInstrumentationTestCase2, which provides more options for
configuring the Activity under test
| |||||||||||
This method is deprecated.
ActivityInstrumentationTestCase is deprecated in favor of
ActivityInstrumentationTestCase2, which provides more options for
configuring the Activity under test
| |||||||||||
Simulate touching the center of a view and dragging to the bottom of the screen.
| |||||||||||
This method is deprecated.
ActivityInstrumentationTestCase is deprecated in favor of
ActivityInstrumentationTestCase2, which provides more options for
configuring the Activity under test
| |||||||||||
Simulate touching the center of a view and dragging to the top of the screen.
| |||||||||||
Simulate touching the center of a view and dragging to the top of the screen.
| |||||||||||
This method is deprecated.
ActivityInstrumentationTestCase is deprecated in favor of
ActivityInstrumentationTestCase2, which provides more options for
configuring the Activity under test
| |||||||||||
Simulate touching a view and dragging it to a specified location.
| |||||||||||
This method is deprecated.
ActivityInstrumentationTestCase is deprecated in favor of
ActivityInstrumentationTestCase2, which provides more options for
configuring the Activity under test
| |||||||||||
Simulate touching a view and dragging it to a specified location.
| |||||||||||
This method is deprecated.
ActivityInstrumentationTestCase is deprecated in favor of
ActivityInstrumentationTestCase2, which provides more options for
configuring the Activity under test
| |||||||||||
This method is deprecated.
ActivityInstrumentationTestCase is deprecated in favor of
ActivityInstrumentationTestCase2, which provides more options for
configuring the Activity under test
| |||||||||||
Simulate touching the center of a view, holding until it is a long press, and then releasing.
| |||||||||||
This method is deprecated.
ActivityInstrumentationTestCase is deprecated in favor of
ActivityInstrumentationTestCase2, which provides more options for
configuring the Activity under test
| |||||||||||
Scroll a ViewGroup to the bottom by repeatedly calling
dragQuarterScreenUp(InstrumentationTestCase, Activity)
| |||||||||||
Scroll a ViewGroup to the top by repeatedly calling
dragQuarterScreenDown(InstrumentationTestCase, Activity)
| |||||||||||
This method is deprecated.
ActivityInstrumentationTestCase is deprecated in favor of
ActivityInstrumentationTestCase2, which provides more options for
configuring the Activity under test
| |||||||||||
Simulate touching the center of a view and releasing quickly (before the tap timeout).
| |||||||||||
Simulate touching the center of a view and cancelling (so no onClick should
fire, etc).
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
|
Simulate touching the center of a view and releasing.
test | The test case that is being run |
---|---|
v | The view that should be clicked |
Simulate touching a specific location and dragging to a new location.
test | The test case that is being run |
---|---|
fromX | X coordinate of the initial touch, in screen coordinates |
toX | Xcoordinate of the drag destination, in screen coordinates |
fromY | X coordinate of the initial touch, in screen coordinates |
toY | Y coordinate of the drag destination, in screen coordinates |
stepCount | How many move steps to include in the drag |
This method is deprecated.ActivityInstrumentationTestCase is deprecated in favor of ActivityInstrumentationTestCase2, which provides more options for configuring the Activity under test
Simulate touching a specific location and dragging to a new location.
test | The test case that is being run |
---|---|
fromX | X coordinate of the initial touch, in screen coordinates |
toX | Xcoordinate of the drag destination, in screen coordinates |
fromY | X coordinate of the initial touch, in screen coordinates |
toY | Y coordinate of the drag destination, in screen coordinates |
stepCount | How many move steps to include in the drag |
Simulate touching in the center of the screen and dragging one quarter of the way down
test | The test case that is being run |
---|---|
activity | The activity that is in the foreground of the test case |
This method is deprecated.ActivityInstrumentationTestCase is deprecated in favor of ActivityInstrumentationTestCase2, which provides more options for configuring the Activity under test
Simulate touching in the center of the screen and dragging one quarter of the way down
test | The test case that is being run |
---|
Simulate touching in the center of the screen and dragging one quarter of the way up
test | The test case that is being run |
---|---|
activity | The activity that is in the foreground of the test case |
This method is deprecated.ActivityInstrumentationTestCase is deprecated in favor of ActivityInstrumentationTestCase2, which provides more options for configuring the Activity under test
Simulate touching in the center of the screen and dragging one quarter of the way up
test | The test case that is being run |
---|
This method is deprecated.ActivityInstrumentationTestCase is deprecated in favor of ActivityInstrumentationTestCase2, which provides more options for configuring the Activity under test
Simulate touching a view and dragging it by the specified amount.
test | The test case that is being run |
---|---|
v | The view that should be dragged |
gravity | 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 pixels |
deltaY | Amount to drag vertically in pixels |
This method is deprecated.ActivityInstrumentationTestCase is deprecated in favor of ActivityInstrumentationTestCase2, which provides more options for configuring the Activity under test
Simulate touching a view and dragging it by the specified amount.
test | The test case that is being run |
---|---|
v | The view that should be dragged |
gravity | 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 pixels |
deltaY | Amount to drag vertically in pixels |
This method is deprecated.ActivityInstrumentationTestCase is deprecated in favor of ActivityInstrumentationTestCase2, which provides more options for configuring the Activity under test
Simulate touching a view and dragging it to a specified location.
test | The test case that is being run |
---|---|
v | The view that should be dragged |
gravity | 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 |
toY | Final location of the view after dragging |
Simulate touching a view and dragging it to a specified location.
test | The test case that is being run |
---|---|
v | The view that should be dragged |
gravity | 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 |
toY | Final location of the view after dragging |
Simulate touching the center of a view and dragging to the bottom of the screen.
test | The test case that is being run |
---|---|
activity | The activity that is in the foreground of the test case |
v | The view that should be dragged |
This method is deprecated.ActivityInstrumentationTestCase is deprecated in favor of ActivityInstrumentationTestCase2, which provides more options for configuring the Activity under test
Simulate touching the center of a view and dragging to the bottom of the screen.
test | The test case that is being run |
---|---|
v | The view that should be dragged |
stepCount | How many move steps to include in the drag |
This method is deprecated.ActivityInstrumentationTestCase is deprecated in favor of ActivityInstrumentationTestCase2, which provides more options for configuring the Activity under test
Simulate touching the center of a view and dragging to the bottom of the screen.
test | The test case that is being run |
---|---|
v | The view that should be dragged |
Simulate touching the center of a view and dragging to the bottom of the screen.
test | The test case that is being run |
---|---|
activity | The activity that is in the foreground of the test case |
v | The view that should be dragged |
stepCount | How many move steps to include in the drag |
This method is deprecated.ActivityInstrumentationTestCase is deprecated in favor of ActivityInstrumentationTestCase2, which provides more options for configuring the Activity under test
Simulate touching the center of a view and dragging to the top of the screen.
test | The test case that is being run |
---|---|
v | The view that should be dragged |
stepCount | How many move steps to include in the drag |
Simulate touching the center of a view and dragging to the top of the screen.
test | The test case that is being run |
---|---|
v | The view that should be dragged |
Simulate touching the center of a view and dragging to the top of the screen.
test | The test case that is being run |
---|---|
v | The view that should be dragged |
stepCount | How many move steps to include in the drag |
This method is deprecated.ActivityInstrumentationTestCase is deprecated in favor of ActivityInstrumentationTestCase2, which provides more options for configuring the Activity under test
Simulate touching the center of a view and dragging to the top of the screen.
test | The test case that is being run |
---|---|
v | The view that should be dragged |
Simulate touching a view and dragging it to a specified location. Only moves horizontally.
test | The test case that is being run |
---|---|
v | The view that should be dragged |
gravity | 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 |
This method is deprecated.ActivityInstrumentationTestCase is deprecated in favor of ActivityInstrumentationTestCase2, which provides more options for configuring the Activity under test
Simulate touching a view and dragging it to a specified location. Only moves horizontally.
test | The test case that is being run |
---|---|
v | The view that should be dragged |
gravity | 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 |
Simulate touching a view and dragging it to a specified location. Only moves vertically.
test | The test case that is being run |
---|---|
v | The view that should be dragged |
gravity | 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 |
This method is deprecated.ActivityInstrumentationTestCase is deprecated in favor of ActivityInstrumentationTestCase2, which provides more options for configuring the Activity under test
Simulate touching a view and dragging it to a specified location. Only moves vertically.
test | The test case that is being run |
---|---|
v | The view that should be dragged |
gravity | 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 |
This method is deprecated.ActivityInstrumentationTestCase is deprecated in favor of ActivityInstrumentationTestCase2, which provides more options for configuring the Activity under test
Simulate touching the center of a view, holding until it is a long press, and then releasing.
test | The test case that is being run |
---|---|
v | The view that should be clicked |
Simulate touching the center of a view, holding until it is a long press, and then releasing.
test | The test case that is being run |
---|---|
v | The view that should be clicked |
This method is deprecated.ActivityInstrumentationTestCase is deprecated in favor of ActivityInstrumentationTestCase2, which provides more options for configuring the Activity under test
Scroll a ViewGroup to the bottom by repeatedly calling dragQuarterScreenUp(InstrumentationTestCase, Activity)
test | The test case that is being run |
---|---|
v | The ViewGroup that should be dragged |
Scroll a ViewGroup to the bottom by repeatedly calling dragQuarterScreenUp(InstrumentationTestCase, Activity)
test | The test case that is being run |
---|---|
activity | The activity that is in the foreground of the test case |
v | The ViewGroup that should be dragged |
Scroll a ViewGroup to the top by repeatedly calling dragQuarterScreenDown(InstrumentationTestCase, Activity)
test | The test case that is being run |
---|---|
activity | The activity that is in the foreground of the test case |
v | The ViewGroup that should be dragged |
This method is deprecated.ActivityInstrumentationTestCase is deprecated in favor of ActivityInstrumentationTestCase2, which provides more options for configuring the Activity under test
Scroll a ViewGroup to the top by repeatedly calling dragQuarterScreenDown(InstrumentationTestCase, Activity)
test | The test case that is being run |
---|---|
v | The ViewGroup that should be dragged |
Simulate touching the center of a view and releasing quickly (before the tap timeout).
test | The test case that is being run |
---|---|
v | The view that should be clicked |
Simulate touching the center of a view and cancelling (so no onClick should fire, etc).
test | The test case that is being run |
---|---|
v | The view that should be clicked |