ListTouchTestpublic class ListTouchTest 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.ListTopGravity | mActivity | private android.widget.ListView | mListView |
Constructors Summary |
---|
public ListTouchTest()
super("com.android.frameworktest", ListTopGravity.class);
|
Methods Summary |
---|
protected void | setUp()
super.setUp();
mActivity = getActivity();
mListView = getActivity().getListView();
| public void | testPreconditions()
assertNotNull(mActivity);
assertNotNull(mListView);
// First item should be selected
assertEquals(0, mListView.getSelectedItemPosition());
| public void | testPullDown()
View firstChild = mListView.getChildAt(0);
TouchUtils.dragViewToBottom(this, firstChild);
// Nothing should be selected
assertEquals("Selection still available after touch", -1,
mListView.getSelectedItemPosition());
firstChild = mListView.getChildAt(0);
assertEquals("Item zero not the first child in the list", 0, firstChild.getId());
assertEquals("Item zero not at the top of the list", mListView.getListPaddingTop(),
firstChild.getTop());
| public void | testPushUp()
View lastChild = mListView.getChildAt(mListView.getChildCount() - 1);
TouchUtils.dragViewToTop(this, lastChild);
// Nothing should be selected
assertEquals("Selection still available after touch", -1,
mListView.getSelectedItemPosition());
View firstChild = mListView.getChildAt(0);
assertEquals("Item zero not the first child in the list", 0, firstChild.getId());
assertEquals("Item zero not at the top of the list", mListView.getListPaddingTop(),
firstChild.getTop());
|
|