Search in sources :

Example 41 with MediumTest

use of android.test.suitebuilder.annotation.MediumTest in project android_frameworks_base by ParanoidAndroid.

the class ListItemRequestRectAboveThinFirstItemTest method testSecondItemRequestRectAboveTop.

// reproduce bug 998501: when first item fits within fading edge,
// having the second item call requestRectangleOnScreen with a rect above
// the bounds of the list, it was scrolling too far
@MediumTest
public void testSecondItemRequestRectAboveTop() throws Exception {
    sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
    assertEquals("selected position", 1, mListView.getSelectedItemPosition());
    final View second = mListView.getChildAt(1);
    final Rect rect = new Rect();
    second.getDrawingRect(rect);
    rect.offset(0, -2 * second.getBottom());
    getActivity().requestRectangleOnScreen(1, rect);
    getInstrumentation().waitForIdleSync();
    assertEquals("top of first item", mListView.getListPaddingTop(), mListView.getChildAt(0).getTop());
}
Also used : Rect(android.graphics.Rect) View(android.view.View) ListView(android.widget.ListView) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 42 with MediumTest

use of android.test.suitebuilder.annotation.MediumTest in project android_frameworks_base by ParanoidAndroid.

the class ListViewHeightTest method testButtons.

@MediumTest
public void testButtons() {
    Instrumentation inst = getInstrumentation();
    final Button button1 = (Button) mActivity.findViewById(R.id.button1);
    final Button button2 = (Button) mActivity.findViewById(R.id.button2);
    final Button button3 = (Button) mActivity.findViewById(R.id.button3);
    ListView list = (ListView) mActivity.findViewById(R.id.inner_list);
    assertEquals("Unexpected items in adapter", 0, list.getCount());
    assertEquals("Unexpected children in list view", 0, list.getChildCount());
    mActivity.runOnUiThread(new Runnable() {

        public void run() {
            button1.performClick();
        }
    });
    inst.waitForIdleSync();
    assertTrue("List not be visible after clicking button1", list.isShown());
    assertTrue("List incorrect height", list.getHeight() == 200);
    mActivity.runOnUiThread(new Runnable() {

        public void run() {
            button2.performClick();
        }
    });
    inst.waitForIdleSync();
    assertTrue("List not be visible after clicking button2", list.isShown());
    mActivity.runOnUiThread(new Runnable() {

        public void run() {
            button3.performClick();
        }
    });
    inst.waitForIdleSync();
    assertFalse("List should not be visible clicking button3", list.isShown());
}
Also used : ListView(android.widget.ListView) Button(android.widget.Button) Instrumentation(android.app.Instrumentation) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 43 with MediumTest

use of android.test.suitebuilder.annotation.MediumTest in project android_frameworks_base by ParanoidAndroid.

the class GridTouchStackFromBottomTest method testPullDownFast.

@MediumTest
public void testPullDownFast() {
    TouchUtils.dragViewToBottom(this, mGridView.getChildAt(0), 2);
    // Nothing should be selected
    assertEquals("Selection still available after touch", -1, mGridView.getSelectedItemPosition());
    View lastChild = mGridView.getChildAt(mGridView.getChildCount() - 1);
    assertEquals("Last item not the last child in the grid", mGridView.getAdapter().getCount() - 1, lastChild.getId());
    assertEquals("Last item not at the bottom of the grid", mGridView.getHeight() - mGridView.getListPaddingBottom(), lastChild.getBottom());
}
Also used : GridView(android.widget.GridView) View(android.view.View) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 44 with MediumTest

use of android.test.suitebuilder.annotation.MediumTest in project android_frameworks_base by ParanoidAndroid.

the class ListOfButtonsTest method testNavigateToSecondItem.

@MediumTest
public void testNavigateToSecondItem() {
    sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
    assertTrue(mListView.hasFocus());
    View childOne = mListView.getChildAt(1);
    assertNotNull(childOne);
    assertEquals(childOne, mListView.getFocusedChild());
    assertTrue(childOne.hasFocus());
}
Also used : View(android.view.View) ListView(android.widget.ListView) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 45 with MediumTest

use of android.test.suitebuilder.annotation.MediumTest in project android_frameworks_base by ParanoidAndroid.

the class ListItemFocusablesCloseTest method testPreconditions.

@MediumTest
public void testPreconditions() {
    assertNotNull(mListView);
    assertTrue(mListView.getAdapter().areAllItemsEnabled());
    assertTrue(mListView.getItemsCanFocus());
    assertEquals(0, mListView.getSelectedItemPosition());
    final LinearLayout first = (LinearLayout) mListView.getSelectedView();
    getInstrumentation().waitForIdleSync();
    assertEquals("first item should be at top of screen", mListView.getListPaddingTop(), first.getTop());
    assertTrue("first button of first list item should have focus", first.getChildAt(0).isFocused());
    assertTrue("item should be shorter than list for this test to make sense", first.getHeight() < mListView.getHeight());
    assertEquals("two items should be on screen", 2, mListView.getChildCount());
    assertTrue("first button of second item should be on screen", getActivity().getChildOfItem(1, 0).getBottom() < mListBottom);
}
Also used : LinearLayout(android.widget.LinearLayout) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Aggregations

MediumTest (android.test.suitebuilder.annotation.MediumTest)1023 View (android.view.View)246 ListView (android.widget.ListView)151 Cursor (android.database.Cursor)116 Handler (android.os.Handler)116 Suppress (android.test.suitebuilder.annotation.Suppress)73 TextView (android.widget.TextView)67 ContentValues (android.content.ContentValues)63 ServiceStatus (com.vodafone360.people.service.ServiceStatus)60 SQLiteCursor (android.database.sqlite.SQLiteCursor)54 SQLiteStatement (android.database.sqlite.SQLiteStatement)49 IOException (java.io.IOException)49 UiThreadTest (android.test.UiThreadTest)48 Message (android.os.Message)43 LogRec (com.android.internal.util.StateMachine.LogRec)42 Intent (android.content.Intent)40 ContentResolver (android.content.ContentResolver)37 GridView (android.widget.GridView)36 InputStream (java.io.InputStream)36 ByteArrayInputStream (java.io.ByteArrayInputStream)35