FileDocCategorySizeDatePackage
ListWithSeparatorsTest.javaAPI DocAndroid 1.5 API2648Wed May 06 22:42:02 BST 2009com.android.frameworktest.listview.arrowscroll

ListWithSeparatorsTest

public class ListWithSeparatorsTest extends android.test.ActivityInstrumentationTestCase

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

        super("com.android.frameworktest", 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());