GridTouchStackFromBottomTestpublic class GridTouchStackFromBottomTest extends android.test.ActivityInstrumentationTestCase
Fields Summary |
---|
private com.android.frameworktest.gridview.GridStackFromBottom | mActivity | private android.widget.GridView | mGridView |
Constructors Summary |
---|
public GridTouchStackFromBottomTest()
super("com.android.frameworktest", GridStackFromBottom.class);
|
Methods Summary |
---|
protected void | setUp()
super.setUp();
mActivity = getActivity();
mGridView = getActivity().getGridView();
| public void | testPreconditions()
assertNotNull(mActivity);
assertNotNull(mGridView);
// First item should be selected
assertEquals(mGridView.getAdapter().getCount() - 1, mGridView.getSelectedItemPosition());
| public void | testPullDown()
TouchUtils.scrollToTop(this, mGridView);
// Nothing should be selected
assertEquals("Selection still available after touch", -1,
mGridView.getSelectedItemPosition());
View lastChild = mGridView.getChildAt(mGridView.getChildCount() - 1);
assertEquals("Last item not the last child in the grid",
mGridView.getAdapter().getCount() - 1, lastChild.getId());
assertEquals("Last item not at the bottom of the grid",
mGridView.getHeight() - mGridView.getListPaddingBottom(), lastChild.getBottom());
| public void | testPullDownFast()
TouchUtils.dragViewToBottom(this, mGridView.getChildAt(0), 2);
// Nothing should be selected
assertEquals("Selection still available after touch", -1,
mGridView.getSelectedItemPosition());
View lastChild = mGridView.getChildAt(mGridView.getChildCount() - 1);
assertEquals("Last item not the last child in the grid",
mGridView.getAdapter().getCount() - 1, lastChild.getId());
assertEquals("Last item not at the bottom of the grid",
mGridView.getHeight() - mGridView.getListPaddingBottom(), lastChild.getBottom());
| public void | testPushUp()
TouchUtils.scrollToBottom(this, mGridView);
// Nothing should be selected
assertEquals("Selection still available after touch", -1,
mGridView.getSelectedItemPosition());
View lastChild = mGridView.getChildAt(mGridView.getChildCount() - 1);
assertEquals("Last item not the last child in the grid",
mGridView.getAdapter().getCount() - 1, lastChild.getId());
assertEquals("Last item not at the bottom of the grid",
mGridView.getHeight() - mGridView.getListPaddingBottom(), lastChild.getBottom());
| public void | testPushUpFast()
TouchUtils.dragViewToTop(this, mGridView.getChildAt(mGridView.getChildCount() - 1), 2);
// Nothing should be selected
assertEquals("Selection still available after touch", -1,
mGridView.getSelectedItemPosition());
View lastChild = mGridView.getChildAt(mGridView.getChildCount() - 1);
assertEquals("Last item not the last child in the grid",
mGridView.getAdapter().getCount() - 1, lastChild.getId());
assertEquals("Last item not at the bottom of the grid",
mGridView.getHeight() - mGridView.getListPaddingBottom(), lastChild.getBottom());
|
|