Simplify/fix testThreeButtonsTaskbarBoundsAfterConfigChangeDuringIme
Instead of dealing with changing dark theme which can lead to races with stale Taskbar icons, instead just go home and launch the IME activity. This is sufficient because the taskbar height changes when going between home and an app, and the IME will stash the Taskbar during this transition. Fixes: 320490387 Test: testThreeButtonsTaskbarBoundsAfterConfigChangeDuringIme Flag: None Change-Id: Ib5b1481751af0bf1fccda085c78174f6612441b9
This commit is contained in:
@@ -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();
|
||||
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();
|
||||
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);
|
||||
}
|
||||
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();
|
||||
// Close IME to check new taskbar bounds.
|
||||
startTestActivity(2);
|
||||
Rect taskbarBoundsAfter = getTaskbar().getVisibleBounds();
|
||||
Assert.assertEquals(
|
||||
"Taskbar bounds are not the same after a configuration change while stashed.",
|
||||
taskbarBoundsBefore, taskbarBoundsAfter);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user