FileDocCategorySizeDatePackage
MultiPageTextWithPaddingTest.javaAPI DocAndroid 5.1 API2466Thu Mar 12 22:22:12 GMT 2015android.widget.scroll.arrowscroll

MultiPageTextWithPaddingTest

public class MultiPageTextWithPaddingTest extends android.test.ActivityInstrumentationTestCase

Fields Summary
private android.widget.ScrollView
mScrollView
private android.widget.TextView
mTextView
Constructors Summary
public MultiPageTextWithPaddingTest()

        super("com.android.frameworks.coretests", MultiPageTextWithPadding.class);
    
Methods Summary
protected voidsetUp()

        super.setUp();

        mScrollView = getActivity().getScrollView();
        mTextView = getActivity().getContentChildAt(0);
    
public voidtestPreconditions()

        assertTrue("text should not fit on screen",
                   mTextView.getHeight() > mScrollView.getHeight());
    
public voidtestScrollDownToBottom()

        // 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());