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

Commit 8c4482a7 authored by CHIA-HSUAN HSU's avatar CHIA-HSUAN HSU Committed by CHIA-HSUAN HSU (xWF)
Browse files

b/418238803 Migrate MaximizeAppViaHeaderMenu to legacy flicker test

Test: USE_RBE=false atest WMShellFlickerTestsDesktopMode:com.android.wm.shell.flicker.maximize.MaximizeAppViaHeaderMenuFlickerTest -c (http://ab/I90200010415976194)
Video: http://recall/-/dAvFAgBPEP1i2uq5QXNQfX
Flag: EXEMPT migrate test case
Bug: 418238803
Change-Id: Ie6164f6308c0dd8822e35ce1926baf2d94ef5ef1
parent 7be6f8a4
Loading
Loading
Loading
Loading
+0 −55
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.flicker

import android.tools.Rotation.ROTATION_0
import android.tools.flicker.FlickerConfig
import android.tools.flicker.annotation.ExpectedScenarios
import android.tools.flicker.annotation.FlickerConfigProvider
import android.tools.flicker.config.FlickerConfig
import android.tools.flicker.config.FlickerServiceConfig
import android.tools.flicker.junit.FlickerServiceJUnit4ClassRunner
import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.helpers.DesktopModeAppHelper.MaximizeDesktopAppTrigger
import com.android.wm.shell.flicker.DesktopModeFlickerScenarios.Companion.MAXIMIZE_APP
import com.android.wm.shell.scenarios.MaximizeAppWindow
import org.junit.Test
import org.junit.runner.RunWith

/**
 * Maximize app window by tapping on the maximize button within the app header maximize menu.
 *
 * Assert that the app window keeps the same increases in size, filling the vertical and horizontal
 * stable display bounds.
 */
@RequiresDevice
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class MaximizeAppViaHeaderMenuPortrait : MaximizeAppWindow(
    rotation = ROTATION_0,
    trigger = MaximizeDesktopAppTrigger.MAXIMIZE_BUTTON_IN_MENU
) {
    @ExpectedScenarios(["MAXIMIZE_APP"])
    @Test
    override fun maximizeAppWindow() = super.maximizeAppWindow()

    companion object {
        @JvmStatic
        @FlickerConfigProvider
        fun flickerConfigProvider(): FlickerConfig =
            FlickerConfig().use(FlickerServiceConfig.DEFAULT).use(MAXIMIZE_APP)
    }
}
 No newline at end of file
+91 −0
Original line number Original line Diff line number Diff line
/*
/*
 * Copyright (C) 2024 The Android Open Source Project
 * Copyright (C) 2025 The Android Open Source Project
 *
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * you may not use this file except in compliance with the License.
@@ -14,21 +14,26 @@
 * limitations under the License.
 * limitations under the License.
 */
 */


package com.android.wm.shell.flicker
package com.android.wm.shell.flicker.maximize


import android.tools.Rotation.ROTATION_90
import android.tools.flicker.FlickerConfig
import android.tools.flicker.annotation.ExpectedScenarios
import android.tools.flicker.annotation.FlickerConfigProvider
import android.tools.flicker.config.FlickerConfig
import android.tools.flicker.config.FlickerServiceConfig
import android.tools.flicker.junit.FlickerServiceJUnit4ClassRunner
import androidx.test.filters.RequiresDevice
import androidx.test.filters.RequiresDevice
import com.android.server.wm.flicker.helpers.DesktopModeAppHelper.MaximizeDesktopAppTrigger
import android.tools.NavBar
import com.android.wm.shell.flicker.DesktopModeFlickerScenarios.Companion.MAXIMIZE_APP
import android.tools.flicker.assertions.FlickerTest
import android.tools.flicker.junit.FlickerParametersRunnerFactory
import android.tools.flicker.legacy.FlickerBuilder
import android.tools.flicker.legacy.LegacyFlickerTest
import android.tools.flicker.legacy.LegacyFlickerTestFactory
import com.android.server.wm.flicker.helpers.DesktopModeAppHelper
import com.android.wm.shell.flicker.DesktopModeBaseTest
import com.android.wm.shell.scenarios.MaximizeAppWindow
import com.android.wm.shell.scenarios.MaximizeAppWindow
import com.android.wm.shell.Utils
import com.android.wm.shell.flicker.utils.appLayerHasMaxDisplayHeightAtEnd
import com.android.wm.shell.flicker.utils.appLayerHasMaxDisplayWidthAtEnd
import com.android.wm.shell.flicker.utils.resizeVeilKeepsIncreasingInSize
import org.junit.Rule
import org.junit.Test
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runner.RunWith
import org.junit.runners.Parameterized


/**
/**
 * Maximize app window by tapping on the maximize button within the app header maximize menu.
 * Maximize app window by tapping on the maximize button within the app header maximize menu.
@@ -36,20 +41,51 @@ import org.junit.runner.RunWith
 * Assert that the app window keeps the same increases in size, filling the vertical and horizontal
 * Assert that the app window keeps the same increases in size, filling the vertical and horizontal
 * stable display bounds.
 * stable display bounds.
 */
 */

@RequiresDevice
@RequiresDevice
@RunWith(FlickerServiceJUnit4ClassRunner::class)
@RunWith(Parameterized::class)
class MaximizeAppViaHeaderMenuLandscape : MaximizeAppWindow(
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
    rotation = ROTATION_90,
class MaximizeAppViaHeaderMenuFlickerTest(flicker: LegacyFlickerTest) : DesktopModeBaseTest(flicker) {
    trigger = MaximizeDesktopAppTrigger.MAXIMIZE_BUTTON_IN_MENU
    inner class MaximizeAppViaHeaderMenuScenario : MaximizeAppWindow(
) {
        rotation = flicker.scenario.startRotation,
    @ExpectedScenarios(["MAXIMIZE_APP"])
        trigger = DesktopModeAppHelper.MaximizeDesktopAppTrigger.MAXIMIZE_BUTTON_IN_MENU
    )

    @Rule
    @JvmField
    val testSetupRule = Utils.testSetupRule(NavBar.MODE_GESTURAL, flicker.scenario.startRotation)
    val scenario = MaximizeAppViaHeaderMenuScenario()
    private val testApp = scenario.testApp

    override val transition: FlickerBuilder.() -> Unit
        get() = {
            setup {
                scenario.setup()
            }
            transitions {
                scenario.maximizeAppWindow()
            }
            teardown {
                scenario.teardown()
            }
        }

    @Test
    fun appLayerHasMaxDisplayHeightAtEnd() = flicker.appLayerHasMaxDisplayHeightAtEnd(testApp)

    @Test
    @Test
    override fun maximizeAppWindow() = super.maximizeAppWindow()
    fun appLayerHasMaxDisplayWidthAtEnd() = flicker.appLayerHasMaxDisplayWidthAtEnd(testApp)

    @Test
    fun resizeVeilKeepsIncreasingInSize() = flicker.resizeVeilKeepsIncreasingInSize(testApp)


    companion object {
    companion object {
        @Parameterized.Parameters(name = "{0}")
        @JvmStatic
        @JvmStatic
        @FlickerConfigProvider
        fun getParams(): Collection<FlickerTest> {
        fun flickerConfigProvider(): FlickerConfig =
            return LegacyFlickerTestFactory.nonRotationTests(
            FlickerConfig().use(FlickerServiceConfig.DEFAULT).use(MAXIMIZE_APP)
                supportedNavigationModes = listOf(NavBar.MODE_GESTURAL)
            )
        }
    }
    }
}
}