FileDocCategorySizeDatePackage
ListRetainsFocusAcrossLayoutsTest.javaAPI DocAndroid 1.5 API3066Wed May 06 22:42:02 BST 2009com.android.frameworktest.listview

ListRetainsFocusAcrossLayoutsTest

public class ListRetainsFocusAcrossLayoutsTest extends android.test.ActivityInstrumentationTestCase

Fields Summary
Constructors Summary
public ListRetainsFocusAcrossLayoutsTest()

        super("com.android.frameworktest", ListItemFocusablesClose.class);
    
Methods Summary
private voidrequestLayoutOnList()

        getActivity().runOnUiThread(new Runnable() {
            public void run() {
                getActivity().getListView().requestLayout();
            }
        });
    
public voidtestBottomButtonOfSecondPositionRetainsFocusAfterLayout()

        sendRepeatedKeys(3, KeyEvent.KEYCODE_DPAD_DOWN);

        assertTrue("bottom botton at position 1 should be focused",
                getActivity().getChildOfItem(1, 2).isFocused());

        requestLayoutOnList();
        getInstrumentation().waitForIdleSync();

        assertTrue("bottom botton at position 1 should be focused after layout",
                getActivity().getChildOfItem(1, 2).isFocused());
    
public voidtestBottomButtonRetainsFocusAfterLayout()


        sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);

        assertTrue("bottom botton at position 0 should be focused",
                getActivity().getChildOfItem(0, 2).isFocused());

        requestLayoutOnList();
        getInstrumentation().waitForIdleSync();

        assertTrue("bottom botton at position 0 should be focused after layout",
                getActivity().getChildOfItem(0, 2).isFocused());
    
public voidtestPreconditions()

        assertTrue("top button at position 0 should be focused",
                getActivity().getChildOfItem(0, 0).isFocused());
    
public voidtestTopButtonOfSecondPositionRetainsFocusAfterLayout()

        sendRepeatedKeys(2, KeyEvent.KEYCODE_DPAD_DOWN);

        assertTrue("top botton at position 1 should be focused",
                getActivity().getChildOfItem(1, 0).isFocused());

        requestLayoutOnList();
        getInstrumentation().waitForIdleSync();

        assertTrue("top botton at position 1 should be focused after layout",
                getActivity().getChildOfItem(1, 0).isFocused());