FileDocCategorySizeDatePackage
LinearLayoutGridTest.javaAPI DocAndroid 1.5 API2831Wed May 06 22:42:02 BST 2009com.android.frameworktest.focus

LinearLayoutGridTest

public class LinearLayoutGridTest extends android.test.SingleLaunchActivityTestCase
Tests focus searching between buttons within a grid that are touching, for example, two buttons next two each other would have the left button's right equal to the right button's left. Same goes for top and bottom edges. This exercises some edge cases of {@link android.view.FocusFinder}.

Fields Summary
private android.view.ViewGroup
mRootView
Constructors Summary
public LinearLayoutGridTest()

        super("com.android.frameworktest", LinearLayoutGrid.class);
    
Methods Summary
protected voidsetUp()

        super.setUp();
        mRootView = getActivity().getRootView();
    
public voidtestGoDownFromMiddle()

        assertEquals(getActivity().getButtonAt(2, 1),
                FocusFinder.getInstance().findNextFocus(
                        mRootView,
                        getActivity().getButtonAt(1, 1),
                        View.FOCUS_DOWN));
    
public voidtestGoLeftFromMiddle()

        assertEquals(getActivity().getButtonAt(1, 0),
                FocusFinder.getInstance().findNextFocus(
                        mRootView,
                        getActivity().getButtonAt(1, 1),
                        View.FOCUS_LEFT));
    
public voidtestGoRightFromMiddle()

        assertEquals(getActivity().getButtonAt(1, 2),
                FocusFinder.getInstance().findNextFocus(
                        mRootView,
                        getActivity().getButtonAt(1, 1),
                        View.FOCUS_RIGHT));
    
public voidtestGoUpFromMiddle()

        assertEquals(getActivity().getButtonAt(0, 1),
                FocusFinder.getInstance().findNextFocus(
                        mRootView,
                        getActivity().getButtonAt(1, 1),
                        View.FOCUS_UP));