Methods Summary |
---|
protected void | setUp()
super.setUp();
mActivity = getActivity();
mGridView = getActivity().getGridView();
|
public void | testPreconditions()
assertNotNull(mActivity);
assertNotNull(mGridView);
// First item should be selected
if (mGridView.isStackFromBottom()) {
assertEquals(mGridView.getAdapter().getCount() - 1,
mGridView.getSelectedItemPosition());
} else {
assertEquals(0, mGridView.getSelectedItemPosition());
}
|
public void | testSetSelectionToMiddle()
final int target = mGridView.getAdapter().getCount() / 2;
mActivity.runOnUiThread(new Runnable() {
public void run() {
mGridView.setSelection(target);
}
});
getInstrumentation().waitForIdleSync();
assertEquals(mGridView.getSelectedItemPosition(), target);
assertNotNull(mGridView.getSelectedView());
ViewAsserts.assertOnScreen(mGridView, mGridView.getSelectedView());
|
public void | testSetSelectionToTheEnd()
final int target = mGridView.getAdapter().getCount() - 1;
mActivity.runOnUiThread(new Runnable() {
public void run() {
mGridView.setSelection(target);
}
});
getInstrumentation().waitForIdleSync();
assertEquals(mGridView.getSelectedItemPosition(), target);
assertNotNull(mGridView.getSelectedView());
ViewAsserts.assertOnScreen(mGridView, mGridView.getSelectedView());
|
public void | testSetSelectionToTheTop()
mActivity.runOnUiThread(new Runnable() {
public void run() {
mGridView.setSelection(0);
}
});
getInstrumentation().waitForIdleSync();
assertEquals(mGridView.getSelectedItemPosition(), 0);
assertNotNull(mGridView.getSelectedView());
ViewAsserts.assertOnScreen(mGridView, mGridView.getSelectedView());
|