From 31b85ddad7a9857b064d3b588c9ae7239a1b093f Mon Sep 17 00:00:00 2001 From: Chilun Huang Date: Thu, 26 May 2022 21:10:23 +0800 Subject: [PATCH] Modify app expected position base on the drag behavior change Because ag/18529596 change the drop position, the test need to modify the expected position of the app. Bug: 232878493 Test: atest EnterSplitScreenByDragFromAllApps Change-Id: Ib4823a899aa42ab2c0b23f9e654cbf13becb02bd --- .../EnterSplitScreenByDragFromAllApps.kt | 44 ++++++------------- 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenByDragFromAllApps.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenByDragFromAllApps.kt index c620c31052b5f..702710caded77 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenByDragFromAllApps.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenByDragFromAllApps.kt @@ -24,15 +24,14 @@ import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.annotation.Group1 import com.android.server.wm.flicker.dsl.FlickerBuilder -import com.android.server.wm.traces.common.Rect -import com.android.wm.shell.flicker.layerBecomesVisible -import com.android.wm.shell.flicker.layerIsVisibleAtEnd import com.android.wm.shell.flicker.appWindowBecomesVisible import com.android.wm.shell.flicker.appWindowIsVisibleAtEnd import com.android.wm.shell.flicker.helpers.SplitScreenHelper -import com.android.wm.shell.flicker.splitScreenDividerBecomesVisible +import com.android.wm.shell.flicker.layerBecomesVisible +import com.android.wm.shell.flicker.layerIsVisibleAtEnd import com.android.wm.shell.flicker.splitAppLayerBoundsBecomesVisible import com.android.wm.shell.flicker.splitAppLayerBoundsIsVisibleAtEnd +import com.android.wm.shell.flicker.splitScreenDividerBecomesVisible import org.junit.Assume import org.junit.Before import org.junit.FixMethodOrder @@ -72,15 +71,10 @@ class EnterSplitScreenByDragFromAllApps( } transitions { taplInstrumentation.launchedAppState.taskbar - .openAllApps() - .getAppIcon(secondaryApp.appName) - .dragToSplitscreen(secondaryApp.component.packageName, - primaryApp.component.packageName) - - endDisplayBounds = wmHelper.currentState.layerState - .displays.firstOrNull { !it.isVirtual } - ?.layerStackSpace - ?: error("Display not found") + .openAllApps() + .getAppIcon(secondaryApp.appName) + .dragToSplitscreen(secondaryApp.component.packageName, + primaryApp.component.packageName) } } @@ -99,12 +93,12 @@ class EnterSplitScreenByDragFromAllApps( @Presubmit @Test fun primaryAppBoundsIsVisibleAtEnd() = testSpec.splitAppLayerBoundsIsVisibleAtEnd( - testSpec.endRotation, primaryApp.component, isAppLeftTop(true)) + testSpec.endRotation, primaryApp.component, false /* splitLeftTop */) @Presubmit @Test fun secondaryAppBoundsBecomesVisible() = testSpec.splitAppLayerBoundsBecomesVisible( - testSpec.endRotation, secondaryApp.component, isAppLeftTop(false)) + testSpec.endRotation, secondaryApp.component, true /* splitLeftTop */) @Presubmit @Test @@ -113,27 +107,17 @@ class EnterSplitScreenByDragFromAllApps( @Presubmit @Test fun secondaryAppWindowBecomesVisible() = - testSpec.appWindowBecomesVisible(secondaryApp.component) - - private fun isAppLeftTop(primary: Boolean): Boolean { - return if (endDisplayBounds.width > endDisplayBounds.height) { - !primary - } else { - primary - } - } + testSpec.appWindowBecomesVisible(secondaryApp.component) companion object { @Parameterized.Parameters(name = "{0}") @JvmStatic fun getParams(): List { return FlickerTestParameterFactory.getInstance().getConfigNonRotationTests( - repetitions = SplitScreenHelper.TEST_REPETITIONS, - // TODO(b/176061063):The 3 buttons of nav bar do not exist in the hierarchy. - supportedNavigationModes = - listOf(WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY)) + repetitions = SplitScreenHelper.TEST_REPETITIONS, + // TODO(b/176061063):The 3 buttons of nav bar do not exist in the hierarchy. + supportedNavigationModes = + listOf(WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY)) } - - private lateinit var endDisplayBounds: Rect } }