FileDocCategorySizeDatePackage
ListWithSeparatorsTest.javaAPI DocAndroid 5.1 API2633Thu Mar 12 22:22:12 GMT 2015android.widget.listview.arrowscroll

ListWithSeparatorsTest

public class ListWithSeparatorsTest extends android.test.ActivityInstrumentationTestCase

Fields Summary
private android.widget.listview.ListWithSeparators
mActivity
private android.widget.ListView
mListView
Constructors Summary
public ListWithSeparatorsTest()

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

        super.setUp();

        mActivity = getActivity();
        mListView = getActivity().getListView();
    
public voidtestGoingDownSkipsOverUnselectable()

        sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
        assertEquals("should have skipped to next selectable ",
                3,
                mListView.getSelectedItemPosition());
    
public voidtestGoingUpDoesnNotHitUnselectableItem()

        sendKeys(KeyEvent.KEYCODE_DPAD_UP);
        assertEquals("selected position should remain the same",
                1, mListView.getSelectedItemPosition());

        assertEquals("seperator should be scrolled flush with top",
                mListView.getListPaddingTop(), mListView.getChildAt(0).getTop());
    
public voidtestGoingUpSkippingOverUnselectable()

        sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
        sendKeys(KeyEvent.KEYCODE_DPAD_UP);
        assertEquals(1, mListView.getSelectedItemPosition());
    
public voidtestPreconditions()

        assertNotNull(mActivity);
        assertNotNull(mListView);
        assertFalse(mListView.getAdapter().areAllItemsEnabled());
        assertFalse(mListView.getAdapter().isEnabled(0));
        assertFalse(mListView.getAdapter().isEnabled(2));
        assertEquals(1, mListView.getSelectedItemPosition());