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

Commit 0956df6e 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

Change-Id: I5aa0b42e08ba9e8c93c9795bc787907336aa6b19
parents 86fa4ede 6797a20a
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());