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

Commit 57ed2386 authored by Eghosa Ewansiha-Vlachavas's avatar Eghosa Ewansiha-Vlachavas Committed by Android (Google) Code Review
Browse files

Merge "Separate corner resize tests into individual scenarios" into main

parents e7dd2090 e23f026f
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -154,6 +154,7 @@ class DesktopModeFlickerScenarios {
                        TaggedCujTransitionMatcher(associatedTransitionRequired = false)
                        TaggedCujTransitionMatcher(associatedTransitionRequired = false)
                    )
                    )
                    .build(),
                    .build(),
                // TODO(373638597) Add AppLayerIncreasesInSize assertion
                assertions = AssertionTemplates.DESKTOP_MODE_APP_VISIBILITY_ASSERTIONS
                assertions = AssertionTemplates.DESKTOP_MODE_APP_VISIBILITY_ASSERTIONS
            )
            )


@@ -208,7 +209,7 @@ class DesktopModeFlickerScenarios {
                assertions =
                assertions =
                AssertionTemplates.DESKTOP_MODE_APP_VISIBILITY_ASSERTIONS +
                AssertionTemplates.DESKTOP_MODE_APP_VISIBILITY_ASSERTIONS +
                        listOf(
                        listOf(
                            AppLayerIncreasesInSize(DESKTOP_MODE_APP),
                            // TODO(373638597) Add AppLayerIncreasesInSize assertion
                            AppWindowHasMaxDisplayHeight(DESKTOP_MODE_APP),
                            AppWindowHasMaxDisplayHeight(DESKTOP_MODE_APP),
                            AppWindowHasMaxDisplayWidth(DESKTOP_MODE_APP)
                            AppWindowHasMaxDisplayWidth(DESKTOP_MODE_APP)
                        ).associateBy({ it }, { AssertionInvocationGroup.BLOCKING }),
                        ).associateBy({ it }, { AssertionInvocationGroup.BLOCKING }),
+2 −2
Original line number Original line Diff line number Diff line
@@ -24,7 +24,7 @@ import android.tools.flicker.config.FlickerConfig
import android.tools.flicker.config.FlickerServiceConfig
import android.tools.flicker.config.FlickerServiceConfig
import android.tools.flicker.junit.FlickerServiceJUnit4ClassRunner
import android.tools.flicker.junit.FlickerServiceJUnit4ClassRunner
import com.android.wm.shell.flicker.DesktopModeFlickerScenarios.Companion.CORNER_RESIZE_TO_MAXIMUM_SIZE
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.Test
import org.junit.runner.RunWith
import org.junit.runner.RunWith


@@ -35,7 +35,7 @@ import org.junit.runner.RunWith
 * Assert that the maximum window size constraint is maintained.
 * Assert that the maximum window size constraint is maintained.
 */
 */
@RunWith(FlickerServiceJUnit4ClassRunner::class)
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class ResizeAppToMaximumWindowSizeLandscape : ResizeAppWithCornerResize(
class ResizeAppToMaximumWindowSizeLandscape : MaximiseAppWithCornerResize(
    rotation = Rotation.ROTATION_90
    rotation = Rotation.ROTATION_90
) {
) {
    @ExpectedScenarios(["CORNER_RESIZE_TO_MAXIMUM_SIZE"])
    @ExpectedScenarios(["CORNER_RESIZE_TO_MAXIMUM_SIZE"])
+2 −2
Original line number Original line Diff line number Diff line
@@ -23,7 +23,7 @@ import android.tools.flicker.config.FlickerConfig
import android.tools.flicker.config.FlickerServiceConfig
import android.tools.flicker.config.FlickerServiceConfig
import android.tools.flicker.junit.FlickerServiceJUnit4ClassRunner
import android.tools.flicker.junit.FlickerServiceJUnit4ClassRunner
import com.android.wm.shell.flicker.DesktopModeFlickerScenarios.Companion.CORNER_RESIZE_TO_MAXIMUM_SIZE
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.Test
import org.junit.runner.RunWith
import org.junit.runner.RunWith


@@ -34,7 +34,7 @@ import org.junit.runner.RunWith
 * Assert that the maximum window size constraint is maintained.
 * Assert that the maximum window size constraint is maintained.
 */
 */
@RunWith(FlickerServiceJUnit4ClassRunner::class)
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class ResizeAppToMaximumWindowSizePortrait : ResizeAppWithCornerResize() {
class ResizeAppToMaximumWindowSizePortrait : MaximiseAppWithCornerResize() {
    @ExpectedScenarios(["CORNER_RESIZE_TO_MAXIMUM_SIZE"])
    @ExpectedScenarios(["CORNER_RESIZE_TO_MAXIMUM_SIZE"])
    @Test
    @Test
    override fun resizeAppWithCornerResizeToMaximumSize() =
    override fun resizeAppWithCornerResizeToMaximumSize() =
+94 −0
Original line number Original line Diff line number Diff line
/*
 * 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)
    }
}
+3 −26
Original line number Original line Diff line number Diff line
@@ -19,11 +19,13 @@ package com.android.wm.shell.scenarios
import android.app.Instrumentation
import android.app.Instrumentation
import android.tools.NavBar
import android.tools.NavBar
import android.tools.Rotation
import android.tools.Rotation
import android.tools.flicker.rules.ChangeDisplayOrientationRule
import android.tools.traces.parsers.WindowManagerStateHelper
import android.tools.traces.parsers.WindowManagerStateHelper
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.UiDevice
import com.android.launcher3.tapl.LauncherInstrumentation
import com.android.launcher3.tapl.LauncherInstrumentation
import com.android.server.wm.flicker.helpers.DesktopModeAppHelper
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.NonResizeableAppHelper
import com.android.server.wm.flicker.helpers.SimpleAppHelper
import com.android.server.wm.flicker.helpers.SimpleAppHelper
import com.android.window.flags.Flags
import com.android.window.flags.Flags
@@ -63,6 +65,7 @@ abstract class ResizeAppWithCornerResize(
    fun setup() {
    fun setup() {
        Assume.assumeTrue(Flags.enableDesktopWindowingMode() && tapl.isTablet)
        Assume.assumeTrue(Flags.enableDesktopWindowingMode() && tapl.isTablet)
        tapl.setEnableRotation(true)
        tapl.setEnableRotation(true)
        ChangeDisplayOrientationRule.setRotation(rotation)
        tapl.setExpectedRotation(rotation.value)
        tapl.setExpectedRotation(rotation.value)
        testApp.enterDesktopWithDrag(wmHelper, device)
        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
    @After
    fun teardown() {
    fun teardown() {
        testApp.exit(wmHelper)
        testApp.exit(wmHelper)
    }
    }

    companion object {
        enum class AppProperty {
            STANDARD,
            NON_RESIZABLE
        }
    }
}
}
Loading