// Calculate the number of arrow scrolls needed to reach the bottom
int scrollsNeeded = (int)Math.ceil(Math.max(0.0f,
(mTextView.getHeight() - mScrollView.getHeight()))
/ mScrollView.getMaxScrollAmount());
for (int i = 0; i < scrollsNeeded; i++) {
sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
}
assertEquals(
"should be fully scrolled to bottom",
getActivity().getLinearLayout().getHeight()
- (mScrollView.getHeight() - mScrollView.getPaddingTop() - mScrollView
.getPaddingBottom()), mScrollView.getScrollY());