use of android.test.suitebuilder.annotation.MediumTest in project android_frameworks_base by ParanoidAndroid.
the class ListItemRequestRectAboveThinFirstItemTest method testSecondItemRequestRectAboveTop.
// reproduce bug 998501: when first item fits within fading edge,
// having the second item call requestRectangleOnScreen with a rect above
// the bounds of the list, it was scrolling too far
@MediumTest
public void testSecondItemRequestRectAboveTop() throws Exception {
sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
assertEquals("selected position", 1, mListView.getSelectedItemPosition());
final View second = mListView.getChildAt(1);
final Rect rect = new Rect();
second.getDrawingRect(rect);
rect.offset(0, -2 * second.getBottom());
getActivity().requestRectangleOnScreen(1, rect);
getInstrumentation().waitForIdleSync();
assertEquals("top of first item", mListView.getListPaddingTop(), mListView.getChildAt(0).getTop());
}
use of android.test.suitebuilder.annotation.MediumTest in project android_frameworks_base by ParanoidAndroid.
the class ListViewHeightTest method testButtons.
@MediumTest
public void testButtons() {
Instrumentation inst = getInstrumentation();
final Button button1 = (Button) mActivity.findViewById(R.id.button1);
final Button button2 = (Button) mActivity.findViewById(R.id.button2);
final Button button3 = (Button) mActivity.findViewById(R.id.button3);
ListView list = (ListView) mActivity.findViewById(R.id.inner_list);
assertEquals("Unexpected items in adapter", 0, list.getCount());
assertEquals("Unexpected children in list view", 0, list.getChildCount());
mActivity.runOnUiThread(new Runnable() {
public void run() {
button1.performClick();
}
});
inst.waitForIdleSync();
assertTrue("List not be visible after clicking button1", list.isShown());
assertTrue("List incorrect height", list.getHeight() == 200);
mActivity.runOnUiThread(new Runnable() {
public void run() {
button2.performClick();
}
});
inst.waitForIdleSync();
assertTrue("List not be visible after clicking button2", list.isShown());
mActivity.runOnUiThread(new Runnable() {
public void run() {
button3.performClick();
}
});
inst.waitForIdleSync();
assertFalse("List should not be visible clicking button3", list.isShown());
}
use of android.test.suitebuilder.annotation.MediumTest in project android_frameworks_base by ParanoidAndroid.
the class GridTouchStackFromBottomTest method testPullDownFast.
@MediumTest
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());
}
use of android.test.suitebuilder.annotation.MediumTest in project android_frameworks_base by ParanoidAndroid.
the class ListOfButtonsTest method testNavigateToSecondItem.
@MediumTest
public void testNavigateToSecondItem() {
sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
assertTrue(mListView.hasFocus());
View childOne = mListView.getChildAt(1);
assertNotNull(childOne);
assertEquals(childOne, mListView.getFocusedChild());
assertTrue(childOne.hasFocus());
}
use of android.test.suitebuilder.annotation.MediumTest in project android_frameworks_base by ParanoidAndroid.
the class ListItemFocusablesCloseTest method testPreconditions.
@MediumTest
public void testPreconditions() {
assertNotNull(mListView);
assertTrue(mListView.getAdapter().areAllItemsEnabled());
assertTrue(mListView.getItemsCanFocus());
assertEquals(0, mListView.getSelectedItemPosition());
final LinearLayout first = (LinearLayout) mListView.getSelectedView();
getInstrumentation().waitForIdleSync();
assertEquals("first item should be at top of screen", mListView.getListPaddingTop(), first.getTop());
assertTrue("first button of first list item should have focus", first.getChildAt(0).isFocused());
assertTrue("item should be shorter than list for this test to make sense", first.getHeight() < mListView.getHeight());
assertEquals("two items should be on screen", 2, mListView.getChildCount());
assertTrue("first button of second item should be on screen", getActivity().getChildOfItem(1, 0).getBottom() < mListBottom);
}
Aggregations