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

Commit 97a1e5d3 authored by Cosmin Băieș's avatar Cosmin Băieș
Browse files

Re-enable testShowHideSelf

In [1] we disabled this test while the insets refactor flag was enabled,
as this caused the show/hide flags to no longer be passed and checked.

However, we should still keep the main logic of the code for
requestShowSelf and requestHideSelf when no flags are used.

  [1]: Ia9e3b102a51f7635539a5af84e83d2fa76832359

Flag: EXEMPT testfix
Bug: 394079410
Test: atest InputMethodServiceTest#testShowHideSelf
Change-Id: Id193d05ff72fa8e318a88a5127b3cead022f28e7
parent 2025a585
Loading
Loading
Loading
Loading
+34 −23
Original line number Diff line number Diff line
@@ -211,7 +211,6 @@ public class InputMethodServiceTest {
     * lose flags like HIDE_IMPLICIT_ONLY.
     */
    @Test
    @RequiresFlagsDisabled(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)
    public void testShowHideSelf() throws Exception {
        setShowImeWithHardKeyboard(true /* enabled */);

@@ -223,13 +222,16 @@ public class InputMethodServiceTest {
                true /* inputViewStarted */);
        assertThat(mInputMethodService.isInputViewShown()).isTrue();

        if (!mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) {
            // IME request to hide itself with flag HIDE_IMPLICIT_ONLY, expect not hide (shown).
            Log.i(TAG, "Call IMS#requestHideSelf(InputMethodManager.HIDE_IMPLICIT_ONLY)");
            verifyInputViewStatusOnMainSync(
                () -> mInputMethodService.requestHideSelf(InputMethodManager.HIDE_IMPLICIT_ONLY),
                    () -> mInputMethodService.requestHideSelf(
                            InputMethodManager.HIDE_IMPLICIT_ONLY),
                    false /* expected */,
                    true /* inputViewStarted */);
            assertThat(mInputMethodService.isInputViewShown()).isTrue();
        }

        // IME request to hide itself without any flags, expect hidden.
        Log.i(TAG, "Call IMS#requestHideSelf(0)");
@@ -237,8 +239,15 @@ public class InputMethodServiceTest {
                () -> mInputMethodService.requestHideSelf(0 /* flags */),
                true /* expected */,
                false /* inputViewStarted */);
        if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) {
            // The IME visibility is only sent at the end of the animation. Therefore, we have to
            // wait until the visibility was sent to the server and the IME window hidden.
            eventually(() -> assertThat(mInputMethodService.isInputViewShown()).isFalse());
        } else {
            assertThat(mInputMethodService.isInputViewShown()).isFalse();
        }

        if (!mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) {
            // IME request to show itself with flag SHOW_IMPLICIT, expect shown.
            Log.i(TAG, "Call IMS#requestShowSelf(InputMethodManager.SHOW_IMPLICIT)");
            verifyInputViewStatusOnMainSync(
@@ -250,11 +259,13 @@ public class InputMethodServiceTest {
            // IME request to hide itself with flag HIDE_IMPLICIT_ONLY, expect hidden.
            Log.i(TAG, "Call IMS#requestHideSelf(InputMethodManager.HIDE_IMPLICIT_ONLY)");
            verifyInputViewStatusOnMainSync(
                () -> mInputMethodService.requestHideSelf(InputMethodManager.HIDE_IMPLICIT_ONLY),
                    () -> mInputMethodService.requestHideSelf(
                            InputMethodManager.HIDE_IMPLICIT_ONLY),
                    true /* expected */,
                    false /* inputViewStarted */);
            assertThat(mInputMethodService.isInputViewShown()).isFalse();
        }
    }

    /**
     * This checks the return value of IMS#onEvaluateInputViewShown,