ListTouchBottomGravityTestpublic class ListTouchBottomGravityTest extends android.test.ActivityInstrumentationTestCase Touch tests for a list where all of the items fit on the screen, and the list
stacks from the bottom. |
Fields Summary |
---|
private android.widget.listview.ListBottomGravity | mActivity | private android.widget.ListView | mListView |
Constructors Summary |
---|
public ListTouchBottomGravityTest()
super("com.android.frameworks.coretests", ListBottomGravity.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(mListView.getAdapter().getCount() - 1, mListView.getSelectedItemPosition());
| public void | testPullDown()
View firstChild = mListView.getChildAt(0);
TouchUtils.dragViewToBottom(this, firstChild);
View lastChild = mListView.getChildAt(mListView.getChildCount() - 1);
// Nothing should be selected
assertEquals("Selection still available after touch", -1,
mListView.getSelectedItemPosition());
assertEquals("List is not scrolled to the bottom", mListView.getAdapter().getCount() - 1,
lastChild.getId());
assertEquals("Last item is not touching the bottom edge",
mListView.getHeight() - mListView.getListPaddingBottom(), lastChild.getBottom());
| public void | testPushUp()
View lastChild = mListView.getChildAt(mListView.getChildCount() - 1);
TouchUtils.dragViewToTop(this, lastChild);
lastChild = mListView.getChildAt(mListView.getChildCount() - 1);
// Nothing should be selected
assertEquals("Selection still available after touch", -1,
mListView.getSelectedItemPosition());
assertEquals("List is not scrolled to the bottom", mListView.getAdapter().getCount() - 1,
lastChild.getId());
assertEquals("Last item is not touching the bottom edge",
mListView.getHeight() - mListView.getListPaddingBottom(), lastChild.getBottom());
|
|