use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.
the class GridTouchSetSelectionTest method testSetSelection.
@LargeTest
public void testSetSelection() {
TouchUtils.dragQuarterScreenDown(this);
TouchUtils.dragQuarterScreenUp(this);
// Nothing should be selected
assertEquals("Selection still available after touch", -1, mGridView.getSelectedItemPosition());
final int targetPosition = mGridView.getAdapter().getCount() / 2;
mActivity.runOnUiThread(new Runnable() {
public void run() {
mGridView.setSelection(targetPosition);
}
});
getInstrumentation().waitForIdleSync();
boolean found = false;
int childCount = mGridView.getChildCount();
for (int i = 0; i < childCount; i++) {
View child = mGridView.getChildAt(i);
if (child.getId() == targetPosition) {
found = true;
break;
}
}
assertTrue("Selected item not visible in list", found);
}
use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.
the class GridTouchStackFromBottomManyTest method testScrollToTop.
@LargeTest
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());
}
use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.
the class ListOfThinItemsTest method testScrollToTop.
@LargeTest
public void testScrollToTop() {
final int numItems = mListView.getAdapter().getCount();
for (int i = 0; i < numItems - 1; i++) {
sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
}
assertEquals("should have moved to last position", numItems - 1, mListView.getSelectedItemPosition());
int listTop = mListView.getListPaddingTop();
final int listBottom = mListView.getHeight() - mListView.getListPaddingBottom();
for (int i = 0; i < numItems; i++) {
int expectedPostion = numItems - (i + 1);
assertEquals("wrong selection at position " + expectedPostion, expectedPostion, mListView.getSelectedItemPosition());
final int topFadingEdge = listTop + mListView.getVerticalFadingEdgeLength();
final View firstChild = mListView.getChildAt(0);
final View lastChild = mListView.getChildAt(mListView.getChildCount() - 1);
final int firstVisiblePosition = firstChild.getId();
int topThreshold = (firstVisiblePosition > 0) ? topFadingEdge : listTop;
String prefix = "after " + i + " up presses, ";
assertTrue(prefix + "selected item is above top threshold (fading edge or top as " + "appropriate)", mListView.getSelectedView().getTop() >= topThreshold);
assertTrue(prefix + "first item in list must be at very top or just above", firstChild.getTop() <= 0);
assertTrue(prefix + "last item in list should be at very bottom or just below", lastChild.getBottom() >= listBottom);
sendKeys(KeyEvent.KEYCODE_DPAD_UP);
}
}
use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.
the class ListWithEditTextHeaderTest method testScrollingDoesNotDetachHeaderViewFromWindow.
@LargeTest
public void testScrollingDoesNotDetachHeaderViewFromWindow() {
View header = mListView.getChildAt(0);
assertNotNull("header is not attached to a window (?!)", header.getWindowToken());
// Scroll header off the screen and back onto the screen
int numItemsOnScreen = mListView.getChildCount();
for (int i = 0; i < numItemsOnScreen; i++) {
sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
}
for (int i = 0; i < numItemsOnScreen; i++) {
sendKeys(KeyEvent.KEYCODE_DPAD_UP);
}
// Make sure the header was not accidentally left detached from its window
assertNotNull("header has lost its window", header.getWindowToken());
}
use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.
the class ScrollViewButtonsAndLabelsTest method testArrowScrollDownToBottomElementOnScreen.
// there should be no offset for vertical fading edge
// if the item is the last one on screen
@LargeTest
public void testArrowScrollDownToBottomElementOnScreen() {
int numGroups = getActivity().getNumButtons();
Button lastButton = getActivity().getButton(numGroups - 1);
assertEquals("button needs to be at the very bottom of the layout for " + "this test to work", mLinearLayout.getHeight(), lastButton.getBottom());
// move down to last button
for (int i = 0; i < numGroups; i++) {
sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
}
getInstrumentation().waitForIdleSync();
assertTrue("last button should have focus", lastButton.hasFocus());
int[] buttonLoc = { 0, 0 };
lastButton.getLocationOnScreen(buttonLoc);
int buttonBottom = buttonLoc[1] + lastButton.getHeight();
assertEquals("button should be at very bottom of screen", mScreenBottom, buttonBottom);
}
Aggregations