Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa58fa17 authored by Evan Rosky's avatar Evan Rosky Committed by android-build-merger
Browse files

Merge "Directly focus button in touchmode coretests" into oc-dev am: 6797a20a

am: 0956df6e

Change-Id: Iacc9eb0da385ac50d37d3165fef850f2bff1cf9f
parents 1cab777a 0956df6e
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -16,16 +16,15 @@

package android.widget.touchmode;

import android.widget.layout.linear.LLEditTextThenButton;
import static android.util.TouchModeFlexibleAsserts.assertInTouchModeAfterTap;
import static android.util.TouchModeFlexibleAsserts.assertInTouchModeAfterClick;
import static android.util.TouchModeFlexibleAsserts.assertInTouchModeAfterTap;

import android.test.ActivityInstrumentationTestCase;
import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest;
import android.view.KeyEvent;
import android.widget.Button;
import android.widget.EditText;
import android.widget.layout.linear.LLEditTextThenButton;

/**
 * Some views, like edit texts, can keep and gain focus even when in touch mode.
@@ -64,7 +63,8 @@ public class TouchModeFocusableTest extends ActivityInstrumentationTestCase<LLEd
    @LargeTest
    public void testClickEditTextGivesItFocus() {
        // go down to button
        sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
        getActivity().runOnUiThread(() -> mButton.requestFocus());
        getInstrumentation().waitForIdleSync();
        assertTrue("button should have focus", mButton.isFocused());

        assertInTouchModeAfterClick(this, mEditText);
@@ -77,7 +77,8 @@ public class TouchModeFocusableTest extends ActivityInstrumentationTestCase<LLEd
    // isn't focusable in touch mode.
    @LargeTest
    public void testEnterTouchModeGivesFocusBackToFocusableInTouchMode() {
        sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
        getActivity().runOnUiThread(() -> mButton.requestFocus());
        getInstrumentation().waitForIdleSync();

        assertTrue("button should have focus",
                mButton.isFocused());