GridTouchStackFromBottomManyTestpublic class GridTouchStackFromBottomManyTest extends android.test.ActivityInstrumentationTestCase
Fields Summary |
---|
private com.android.frameworktest.gridview.GridStackFromBottomMany | mActivity | private android.widget.GridView | mGridView |
Constructors Summary |
---|
public GridTouchStackFromBottomManyTest()
super("com.android.frameworktest", GridStackFromBottomMany.class);
|
Methods Summary |
---|
protected void | setUp()
super.setUp();
mActivity = getActivity();
mGridView = getActivity().getGridView();
| public void | testPreconditions()
assertNotNull(mActivity);
assertNotNull(mGridView);
// Last item should be selected
assertEquals(mGridView.getAdapter().getCount() - 1, mGridView.getSelectedItemPosition());
| public void | testScrollToBottom()
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("Grid is not scrolled to the bottom", mGridView.getAdapter().getCount() - 1,
lastChild.getId());
assertEquals("Last item is not touching the bottom edge",
mGridView.getHeight() - mGridView.getListPaddingBottom(), lastChild.getBottom());
| public void | testScrollToTop()
View firstChild;
TouchUtils.scrollToTop(this, mGridView);
// Nothing should be selected
assertEquals("Selection still available after touch", -1,
mGridView.getSelectedItemPosition());
firstChild = mGridView.getChildAt(0);
assertEquals("Item zero not the first child in the grid", 0, firstChild.getId());
assertEquals("Item zero not at the top of the grid",
mGridView.getListPaddingTop(), firstChild.getTop());
|
|