diff options
author | 2024-10-17 10:05:35 +0000 | |
---|---|---|
committer | 2024-10-17 10:05:35 +0000 | |
commit | 57ed23860a481e5d23ba1b861b0ca80d92628f60 (patch) | |
tree | 7fd99c987a41c48c5bac3e5d31dd450518911c10 | |
parent | e7dd2090ad1c996f558c43c33d65ee6277d2f1f8 (diff) | |
parent | e23f026f90146912f04fb9b4efeb361db6606d59 (diff) |
Merge "Separate corner resize tests into individual scenarios" into main
6 files changed, 108 insertions, 31 deletions
diff --git a/libs/WindowManager/Shell/tests/e2e/desktopmode/flicker-service/src/com/android/wm/shell/flicker/DesktopModeFlickerScenarios.kt b/libs/WindowManager/Shell/tests/e2e/desktopmode/flicker-service/src/com/android/wm/shell/flicker/DesktopModeFlickerScenarios.kt index 7640cb1fb616..b7ddfd1fc6eb 100644 --- a/libs/WindowManager/Shell/tests/e2e/desktopmode/flicker-service/src/com/android/wm/shell/flicker/DesktopModeFlickerScenarios.kt +++ b/libs/WindowManager/Shell/tests/e2e/desktopmode/flicker-service/src/com/android/wm/shell/flicker/DesktopModeFlickerScenarios.kt @@ -154,6 +154,7 @@ class DesktopModeFlickerScenarios { TaggedCujTransitionMatcher(associatedTransitionRequired = false) ) .build(), + // TODO(373638597) Add AppLayerIncreasesInSize assertion assertions = AssertionTemplates.DESKTOP_MODE_APP_VISIBILITY_ASSERTIONS ) @@ -208,7 +209,7 @@ class DesktopModeFlickerScenarios { assertions = AssertionTemplates.DESKTOP_MODE_APP_VISIBILITY_ASSERTIONS + listOf( - AppLayerIncreasesInSize(DESKTOP_MODE_APP), + // TODO(373638597) Add AppLayerIncreasesInSize assertion AppWindowHasMaxDisplayHeight(DESKTOP_MODE_APP), AppWindowHasMaxDisplayWidth(DESKTOP_MODE_APP) ).associateBy({ it }, { AssertionInvocationGroup.BLOCKING }), diff --git a/libs/WindowManager/Shell/tests/e2e/desktopmode/flicker-service/src/com/android/wm/shell/flicker/ResizeAppToMaximumWindowSizeLandscape.kt b/libs/WindowManager/Shell/tests/e2e/desktopmode/flicker-service/src/com/android/wm/shell/flicker/ResizeAppToMaximumWindowSizeLandscape.kt index 0b98ba2a9cd4..aa4f133123f5 100644 --- a/libs/WindowManager/Shell/tests/e2e/desktopmode/flicker-service/src/com/android/wm/shell/flicker/ResizeAppToMaximumWindowSizeLandscape.kt +++ b/libs/WindowManager/Shell/tests/e2e/desktopmode/flicker-service/src/com/android/wm/shell/flicker/ResizeAppToMaximumWindowSizeLandscape.kt @@ -24,7 +24,7 @@ import android.tools.flicker.config.FlickerConfig import android.tools.flicker.config.FlickerServiceConfig import android.tools.flicker.junit.FlickerServiceJUnit4ClassRunner import com.android.wm.shell.flicker.DesktopModeFlickerScenarios.Companion.CORNER_RESIZE_TO_MAXIMUM_SIZE -import com.android.wm.shell.scenarios.ResizeAppWithCornerResize +import com.android.wm.shell.scenarios.MaximiseAppWithCornerResize import org.junit.Test import org.junit.runner.RunWith @@ -35,7 +35,7 @@ import org.junit.runner.RunWith * Assert that the maximum window size constraint is maintained. */ @RunWith(FlickerServiceJUnit4ClassRunner::class) -class ResizeAppToMaximumWindowSizeLandscape : ResizeAppWithCornerResize( +class ResizeAppToMaximumWindowSizeLandscape : MaximiseAppWithCornerResize( rotation = Rotation.ROTATION_90 ) { @ExpectedScenarios(["CORNER_RESIZE_TO_MAXIMUM_SIZE"]) diff --git a/libs/WindowManager/Shell/tests/e2e/desktopmode/flicker-service/src/com/android/wm/shell/flicker/ResizeAppToMaximumWindowSizePortrait.kt b/libs/WindowManager/Shell/tests/e2e/desktopmode/flicker-service/src/com/android/wm/shell/flicker/ResizeAppToMaximumWindowSizePortrait.kt index b1c04d38a46c..e6b1ccf0111f 100644 --- a/libs/WindowManager/Shell/tests/e2e/desktopmode/flicker-service/src/com/android/wm/shell/flicker/ResizeAppToMaximumWindowSizePortrait.kt +++ b/libs/WindowManager/Shell/tests/e2e/desktopmode/flicker-service/src/com/android/wm/shell/flicker/ResizeAppToMaximumWindowSizePortrait.kt @@ -23,7 +23,7 @@ import android.tools.flicker.config.FlickerConfig import android.tools.flicker.config.FlickerServiceConfig import android.tools.flicker.junit.FlickerServiceJUnit4ClassRunner import com.android.wm.shell.flicker.DesktopModeFlickerScenarios.Companion.CORNER_RESIZE_TO_MAXIMUM_SIZE -import com.android.wm.shell.scenarios.ResizeAppWithCornerResize +import com.android.wm.shell.scenarios.MaximiseAppWithCornerResize import org.junit.Test import org.junit.runner.RunWith @@ -34,7 +34,7 @@ import org.junit.runner.RunWith * Assert that the maximum window size constraint is maintained. */ @RunWith(FlickerServiceJUnit4ClassRunner::class) -class ResizeAppToMaximumWindowSizePortrait : ResizeAppWithCornerResize() { +class ResizeAppToMaximumWindowSizePortrait : MaximiseAppWithCornerResize() { @ExpectedScenarios(["CORNER_RESIZE_TO_MAXIMUM_SIZE"]) @Test override fun resizeAppWithCornerResizeToMaximumSize() = diff --git a/libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/scenarios/MaximiseAppWithCornerResize.kt b/libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/scenarios/MaximiseAppWithCornerResize.kt new file mode 100644 index 000000000000..6637b01f9d9c --- /dev/null +++ b/libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/scenarios/MaximiseAppWithCornerResize.kt @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.wm.shell.scenarios + +import android.app.Instrumentation +import android.tools.NavBar +import android.tools.Rotation +import android.tools.flicker.rules.ChangeDisplayOrientationRule +import android.tools.traces.parsers.WindowManagerStateHelper +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.uiautomator.UiDevice +import com.android.launcher3.tapl.LauncherInstrumentation +import com.android.server.wm.flicker.helpers.DesktopModeAppHelper +import com.android.server.wm.flicker.helpers.DesktopModeAppHelper.AppProperty +import com.android.server.wm.flicker.helpers.NonResizeableAppHelper +import com.android.server.wm.flicker.helpers.SimpleAppHelper +import com.android.window.flags.Flags +import com.android.wm.shell.Utils +import org.junit.After +import org.junit.Assume +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test + +@Ignore("Test Base Class") +abstract class MaximiseAppWithCornerResize( + val rotation: Rotation = Rotation.ROTATION_0, + val appProperty: AppProperty = AppProperty.STANDARD +) { + + private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() + private val tapl = LauncherInstrumentation() + private val wmHelper = WindowManagerStateHelper(instrumentation) + private val device = UiDevice.getInstance(instrumentation) + private val maxResizeChange = 3000 + private val testApp = + DesktopModeAppHelper( + when (appProperty) { + AppProperty.STANDARD -> SimpleAppHelper(instrumentation) + AppProperty.NON_RESIZABLE -> NonResizeableAppHelper(instrumentation) + } + ) + + @Rule + @JvmField + val testSetupRule = Utils.testSetupRule(NavBar.MODE_GESTURAL, rotation) + + @Before + fun setup() { + Assume.assumeTrue(Flags.enableDesktopWindowingMode() && tapl.isTablet) + tapl.setEnableRotation(true) + tapl.setExpectedRotation(rotation.value) + ChangeDisplayOrientationRule.setRotation(rotation) + testApp.enterDesktopWithDrag(wmHelper, device) + testApp.cornerResize( + wmHelper, + device, + DesktopModeAppHelper.Corners.RIGHT_TOP, + maxResizeChange, + -maxResizeChange + ) + } + + @Test + open fun resizeAppWithCornerResizeToMaximumSize() { + testApp.cornerResize( + wmHelper, + device, + DesktopModeAppHelper.Corners.LEFT_BOTTOM, + -maxResizeChange, + maxResizeChange + ) + } + + @After + fun teardown() { + testApp.exit(wmHelper) + } +} diff --git a/libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/scenarios/ResizeAppWithCornerResize.kt b/libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/scenarios/ResizeAppWithCornerResize.kt index bd25639466a3..a7cebf402d8e 100644 --- a/libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/scenarios/ResizeAppWithCornerResize.kt +++ b/libs/WindowManager/Shell/tests/e2e/desktopmode/scenarios/src/com/android/wm/shell/scenarios/ResizeAppWithCornerResize.kt @@ -19,11 +19,13 @@ package com.android.wm.shell.scenarios import android.app.Instrumentation import android.tools.NavBar import android.tools.Rotation +import android.tools.flicker.rules.ChangeDisplayOrientationRule import android.tools.traces.parsers.WindowManagerStateHelper import androidx.test.platform.app.InstrumentationRegistry import androidx.test.uiautomator.UiDevice import com.android.launcher3.tapl.LauncherInstrumentation import com.android.server.wm.flicker.helpers.DesktopModeAppHelper +import com.android.server.wm.flicker.helpers.DesktopModeAppHelper.AppProperty import com.android.server.wm.flicker.helpers.NonResizeableAppHelper import com.android.server.wm.flicker.helpers.SimpleAppHelper import com.android.window.flags.Flags @@ -63,6 +65,7 @@ abstract class ResizeAppWithCornerResize( fun setup() { Assume.assumeTrue(Flags.enableDesktopWindowingMode() && tapl.isTablet) tapl.setEnableRotation(true) + ChangeDisplayOrientationRule.setRotation(rotation) tapl.setExpectedRotation(rotation.value) testApp.enterDesktopWithDrag(wmHelper, device) } @@ -78,34 +81,8 @@ abstract class ResizeAppWithCornerResize( ) } - @Test - open fun resizeAppWithCornerResizeToMaximumSize() { - val maxResizeChange = 3000 - testApp.cornerResize( - wmHelper, - device, - DesktopModeAppHelper.Corners.RIGHT_TOP, - maxResizeChange, - -maxResizeChange - ) - testApp.cornerResize( - wmHelper, - device, - DesktopModeAppHelper.Corners.LEFT_BOTTOM, - -maxResizeChange, - maxResizeChange - ) - } - @After fun teardown() { testApp.exit(wmHelper) } - - companion object { - enum class AppProperty { - STANDARD, - NON_RESIZABLE - } - } } diff --git a/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/DesktopModeAppHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/DesktopModeAppHelper.kt index c77413b6a55a..c6855b4a97b4 100644 --- a/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/DesktopModeAppHelper.kt +++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/DesktopModeAppHelper.kt @@ -59,6 +59,11 @@ open class DesktopModeAppHelper(private val innerHelper: IStandardAppHelper) : BOTTOM } + enum class AppProperty { + STANDARD, + NON_RESIZABLE + } + /** Wait for an app moved to desktop to finish its transition. */ private fun waitForAppToMoveToDesktop(wmHelper: WindowManagerStateHelper) { wmHelper |