ListOfTouchablesTestpublic class ListOfTouchablesTest extends android.test.ActivityInstrumentationTestCase Touch tests for a list where all of the items fit on the screen. |
Fields Summary |
---|
private com.android.frameworktest.listview.ListOfTouchables | mActivity | private android.widget.ListView | mListView |
Constructors Summary |
---|
public ListOfTouchablesTest()
super("com.android.frameworktest", ListOfTouchables.class);
|
Methods Summary |
---|
protected void | setUp()
super.setUp();
mActivity = getActivity();
mListView = getActivity().getListView();
| public void | testLongScroll()
View lastChild = mListView.getChildAt(mListView.getChildCount() - 1);
int lastTop = lastChild.getTop();
int distance = TouchUtils.dragViewToY(this, lastChild,
Gravity.TOP | Gravity.LEFT, mListView.getTop());
assertEquals("View scrolled to wrong position",
lastTop - (distance - ViewConfiguration.getTouchSlop() - 1), lastChild.getTop());
| public void | testPreconditions()
assertNotNull(mActivity);
assertNotNull(mListView);
| public void | testShortScroll()
View firstChild = mListView.getChildAt(0);
View lastChild = mListView.getChildAt(mListView.getChildCount() - 1);
int firstTop = firstChild.getTop();
TouchUtils.dragViewBy(this, lastChild, Gravity.TOP | Gravity.LEFT,
0, -(ViewConfiguration.getTouchSlop() + 1 + 10));
View newFirstChild = mListView.getChildAt(0);
assertEquals("View scrolled too early", firstTop, newFirstChild.getTop() + 10);
assertEquals("Wrong view in first position", 0, newFirstChild.getId());
|
|