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

Commit 0961a69f authored by Tony Wickham's avatar Tony Wickham Committed by Android (Google) Code Review
Browse files

Merge "Simplify/fix testThreeButtonsTaskbarBoundsAfterConfigChangeDuringIme" into main

parents e4826e93 58b3b5b5
Loading
Loading
Loading
Loading
+13 −27
Original line number Diff line number Diff line
@@ -15,18 +15,14 @@
 */
package com.android.quickstep;

import static com.android.launcher3.util.rule.TestStabilityRule.LOCAL;
import static com.android.launcher3.util.rule.TestStabilityRule.PLATFORM_POSTSUBMIT;
import static com.android.quickstep.TaskbarModeSwitchRule.Mode.PERSISTENT;

import android.graphics.Rect;

import androidx.test.filters.LargeTest;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;

import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape;
import com.android.launcher3.util.rule.TestStabilityRule;
import com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch;
import com.android.quickstep.TaskbarModeSwitchRule.TaskbarModeSwitch;

@@ -34,9 +30,6 @@ import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.io.Closeable;
import java.io.IOException;

@LargeTest
@RunWith(AndroidJUnit4.class)
public class TaplTestsPersistentTaskbar extends AbstractTaplTestsTaskbar {
@@ -51,27 +44,20 @@ public class TaplTestsPersistentTaskbar extends AbstractTaplTestsTaskbar {
    }

    @Test
    @TestStabilityRule.Stability(flavors = LOCAL | PLATFORM_POSTSUBMIT) // b/320490387
    @NavigationModeSwitch(mode = NavigationModeSwitchRule.Mode.THREE_BUTTON)
    public void testThreeButtonsTaskbarBoundsAfterConfigChangeDuringIme() {
        // Start off in light mode.
        try (Closeable c = InstrumentationRegistry.getInstrumentation().getUiAutomation()
                .executeShellCommand("cmd uimode night no")) {
        Rect taskbarBoundsBefore = getTaskbar().getVisibleBounds();
        // Go home and to an IME activity (any configuration change would do, as long as it
        // triggers taskbar insets or height change while taskbar is stashed).
        mLauncher.goHome();
        startImeTestActivity();
        // IME should stash the taskbar, which hides icons even in 3 button mode.
        mLauncher.getLaunchedAppState().assertTaskbarHidden();
            // Switch to dark mode (any configuration change here would do).
            InstrumentationRegistry.getInstrumentation().getUiAutomation().executeShellCommand(
                    "cmd uimode night yes").close();
        // Close IME to check new taskbar bounds.
            mLauncher.pressBack();
        startTestActivity(2);
        Rect taskbarBoundsAfter = getTaskbar().getVisibleBounds();
        Assert.assertEquals(
                "Taskbar bounds are not the same after a configuration change while stashed.",
                taskbarBoundsBefore, taskbarBoundsAfter);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}