Search in sources :

Example 36 with LargeTest

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);
}
Also used : GridView(android.widget.GridView) View(android.view.View) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 37 with LargeTest

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());
}
Also used : GridView(android.widget.GridView) View(android.view.View) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 38 with LargeTest

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);
    }
}
Also used : View(android.view.View) ListView(android.widget.ListView) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 39 with LargeTest

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());
}
Also used : View(android.view.View) AbsListView(android.widget.AbsListView) ListView(android.widget.ListView) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 40 with LargeTest

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);
}
Also used : Button(android.widget.Button) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Aggregations

LargeTest (android.test.suitebuilder.annotation.LargeTest)1579 AudioEffect (android.media.audiofx.AudioEffect)234 AudioTrack (android.media.AudioTrack)222 View (android.view.View)147 File (java.io.File)144 MediaVideoItem (android.media.videoeditor.MediaVideoItem)115 Uri (android.net.Uri)99 ListView (android.widget.ListView)72 Cursor (android.database.Cursor)69 Bitmap (android.graphics.Bitmap)62 Instrumentation (android.app.Instrumentation)61 MediaPlayer (android.media.MediaPlayer)60 WifiConfiguration (android.net.wifi.WifiConfiguration)53 SurfaceHolder (android.view.SurfaceHolder)50 MediaImageItem (android.media.videoeditor.MediaImageItem)49 IOException (java.io.IOException)48 AudioManager (android.media.AudioManager)42 LegacyVpnInfo (com.android.internal.net.LegacyVpnInfo)42 VpnProfile (com.android.internal.net.VpnProfile)42 Request (android.app.DownloadManager.Request)41