FileDocCategorySizeDatePackage
GoneParentFocusedChildTest.javaAPI DocAndroid 5.1 API2017Thu Mar 12 22:22:12 GMT 2015android.widget.focus

GoneParentFocusedChildTest

public class GoneParentFocusedChildTest extends android.test.ActivityInstrumentationTestCase
When a parent is GONE, key events shouldn't go to its children, even if they have focus. (part of investigation into issue 945150).

Fields Summary
Constructors Summary
public GoneParentFocusedChildTest()

        super("com.android.frameworks.coretests", GoneParentFocusedChild.class);
    
Methods Summary
public voidtestKeyEventGoesToActivity()

        sendKeys(KeyEvent.KEYCODE_J);
        assertTrue(getActivity().isUnhandledKeyEvent());
    
public voidtestPreconditinos()

        assertNotNull(getActivity().getLayout());
        assertNotNull(getActivity().getGoneGroup());
        assertNotNull(getActivity().getButton());
        assertTrue("button should have focus",
                getActivity().getButton().hasFocus());
        assertEquals("gone group should be, well, gone!",
                View.GONE,
                getActivity().getGoneGroup().getVisibility());
        assertFalse("the activity should have received no key events",
                getActivity().isUnhandledKeyEvent());