FileDocCategorySizeDatePackage
LinearLayoutGridTest.javaAPI DocAndroid 5.1 API2816Thu Mar 12 22:22:12 GMT 2015android.widget.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.frameworks.coretests", 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));