From 237f3a66770dd94b8fa871b522fc98e4714390c1 Mon Sep 17 00:00:00 2001 From: Pat Manning Date: Wed, 13 Sep 2023 15:46:06 +0100 Subject: [PATCH] Add test to check swiping from app to overview without unstashing taskbar. Follow up to ag/24420598 Fix: 293419351 Test: TaplTestsTransientTaskbar. Flag: ENABLE_CURSOR_HOVER_STATES Change-Id: Id5c6b441f45e4e17baa29bc2e1de10a1863d754e --- .../QuickstepTestInformationHandler.java | 4 +--- .../android/quickstep/TaplTestsQuickstep.java | 16 ++++++++++++++++ .../quickstep/TaplTestsTransientTaskbar.java | 4 +--- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java index 031d409ece..9be9294d7c 100644 --- a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java +++ b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java @@ -44,9 +44,7 @@ public class QuickstepTestInformationHandler extends TestInformationHandler { } case TestProtocol.REQUEST_BACKGROUND_TO_OVERVIEW_SWIPE_HEIGHT: { - final float swipeHeight = - LayoutUtils.getShelfTrackingDistance(mContext, mDeviceProfile, - PagedOrientationHandler.PORTRAIT); + final float swipeHeight = mDeviceProfile.heightPx / 2f; response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, (int) swipeHeight); return response; } diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java index 2be38b02b2..5531c6e29f 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java @@ -16,11 +16,13 @@ package com.android.quickstep; +import static com.android.launcher3.config.FeatureFlags.ENABLE_CURSOR_HOVER_STATES; import static com.android.launcher3.testing.shared.TestProtocol.FLAKY_QUICK_SWITCH_TO_PREVIOUS_APP; import static com.android.launcher3.ui.TaplTestsLauncher3.getAppPackageName; 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 static com.android.quickstep.TaskbarModeSwitchRule.Mode.TRANSIENT; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -50,6 +52,7 @@ import com.android.launcher3.tapl.OverviewTaskMenu; import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape; import com.android.launcher3.ui.TaplTestsLauncher3; import com.android.launcher3.util.DisplayController; +import com.android.launcher3.util.TestUtil; import com.android.launcher3.util.Wait; import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord; import com.android.launcher3.util.rule.TestStabilityRule; @@ -242,6 +245,19 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { isInState(() -> LauncherState.OVERVIEW)); } + @Test + @TaskbarModeSwitch(mode = TRANSIENT) + public void testSwitchToOverviewWithStashedTaskbar() throws Exception { + try (AutoCloseable flag = TestUtil.overrideFlag(ENABLE_CURSOR_HOVER_STATES, true)) { + startTestAppsWithCheck(); + // Set ignoreTaskbarVisibility, as transient taskbar will be stashed after app launch. + mLauncher.setIgnoreTaskbarVisibility(true); + mLauncher.getLaunchedAppState().switchToOverview(); + } finally { + mLauncher.setIgnoreTaskbarVisibility(false); + } + } + @Ignore @Test @NavigationModeSwitch diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsTransientTaskbar.java b/quickstep/tests/src/com/android/quickstep/TaplTestsTransientTaskbar.java index 3869bf7642..b3cec4ebc5 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsTransientTaskbar.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsTransientTaskbar.java @@ -66,12 +66,10 @@ public class TaplTestsTransientTaskbar extends AbstractTaplTestsTaskbar { @Test @TaskbarModeSwitch(mode = TRANSIENT) - public void testClickHoveredTaskbarToGoHome() { + public void testClickHoveredTaskbarToGoHome() throws Exception { try (AutoCloseable flag = TestUtil.overrideFlag(ENABLE_CURSOR_HOVER_STATES, true)) { getTaskbar().getAppIcon(TEST_APP_NAME).launch(TEST_APP_PACKAGE); mLauncher.getLaunchedAppState().clickStashedTaskbarToGoHome(); - } catch (Exception e) { - throw new RuntimeException(e); } } }