use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.
the class ShortButtonsTest method testScrollFromBottomToTopThroughButtons.
@LargeTest
public void testScrollFromBottomToTopThroughButtons() throws Exception {
final int numButtons = getActivity().getNumButtons();
final Button lastButton = getActivity().getButtonAt(numButtons - 1);
lastButton.post(new Runnable() {
public void run() {
lastButton.requestFocus();
}
});
getInstrumentation().waitForIdleSync();
assertTrue("lastButton.isFocused()", lastButton.isFocused());
for (int i = numButtons - 1; i >= 0; i--) {
String prefix = "after " + i + " ups expected button " + i;
final Button button = getActivity().getButtonAt(i);
assertTrue(prefix + " to have focus", button.isFocused());
assertTrue(prefix + " to be on screen", isButtonOnScreen(button));
sendKeys(KeyEvent.KEYCODE_DPAD_UP);
}
assertEquals("should be fully scrolled to top", 0, mScrollView.getScrollY());
}
use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.
the class ShortButtonsTest method testScrollDownToBottomThroughButtons.
@LargeTest
public void testScrollDownToBottomThroughButtons() throws Exception {
final int numButtons = getActivity().getNumButtons();
for (int i = 0; i < numButtons; i++) {
String prefix = "after " + i + " downs expected button " + i;
final Button button = getActivity().getButtonAt(i);
assertTrue(prefix + " to have focus", button.isFocused());
assertTrue(prefix + " to be on screen", isButtonOnScreen(button));
sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
}
assertEquals("should be fully scrolled to bottom", getActivity().getLinearLayout().getHeight() - mScrollView.getHeight(), mScrollView.getScrollY());
}
use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.
the class ChangeTouchModeTest method testTouchModeChangedInOtherActivity.
@LargeTest
public void testTouchModeChangedInOtherActivity() throws Exception {
assertFalse("touch mode", getActivity().isInTouchMode());
LLOfButtons2 otherActivity = null;
try {
otherActivity = launchActivity("com.android.frameworks.coretests", LLOfButtons2.class, null);
assertNotNull(otherActivity);
assertFalse(otherActivity.isInTouchMode());
assertInTouchModeAfterClick(this, otherActivity.getFirstButton());
assertTrue(otherActivity.isInTouchMode());
} finally {
if (otherActivity != null) {
otherActivity.finish();
}
}
// need to wait for async update back to window to occur
Thread.sleep(200);
assertTrue("touch mode", getActivity().isInTouchMode());
}
use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.
the class ListGetSelectedViewTest method testGetSelectedView.
@LargeTest
public void testGetSelectedView() {
View last = mListView.getChildAt(1);
TouchUtils.clickView(this, last);
assertNull(mListView.getSelectedItem());
assertNull(mListView.getSelectedView());
assertEquals(-1, mListView.getSelectedItemPosition());
}
use of android.test.suitebuilder.annotation.LargeTest in project android_frameworks_base by ParanoidAndroid.
the class ListSetSelectionTest method testSetSelection.
@LargeTest
public void testSetSelection() {
TouchUtils.dragQuarterScreenDown(this);
TouchUtils.dragQuarterScreenUp(this);
// Nothing should be selected
assertEquals("Selection still available after touch", -1, mListView.getSelectedItemPosition());
final int targetPosition = mListView.getAdapter().getCount() / 2;
mActivity.runOnUiThread(new Runnable() {
public void run() {
mListView.setSelection(targetPosition);
}
});
getInstrumentation().waitForIdleSync();
boolean found = false;
int childCount = mListView.getChildCount();
for (int i = 0; i < childCount; i++) {
View child = mListView.getChildAt(i);
if (child.getId() == targetPosition) {
found = true;
break;
}
}
assertTrue("Selected item not visible in list", found);
}
Aggregations