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

Commit 93ae6995 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "b/433605745 Migrate...

Merge "b/433605745 Migrate MaximizeAppWindowWithDragToTopDragZoneInDesktopFirst to flicker test" into main
parents fc0658ab 367a3db0
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ test_module_config {
        "com.android.wm.shell.flicker.maximize.MaximizeAppFlickerTest",
        "com.android.wm.shell.flicker.maximize.MaximizeAppNonResizableFlickerTest",
        "com.android.wm.shell.flicker.maximize.MaximizeAppViaHeaderMenuFlickerTest",
        "com.android.wm.shell.flicker.maximize.MaximizeAppWindowWithDragToTopDragZoneInDesktopFirstFlickerTest",
        "com.android.wm.shell.flicker.minimize.MinimizeAppsFlickerTest",
        "com.android.wm.shell.flicker.minimize.MinimizeAutoPipAppWindowFlickerTest",
        "com.android.wm.shell.flicker.resizing.ResizeAppToMaximumWindowSizeFlickerTest",
@@ -264,6 +265,13 @@ test_module_config {
    include_filters: ["com.android.wm.shell.flicker.maximize.MaximizeAppViaHeaderMenuFlickerTest"],
}

test_module_config {
    name: "WMShellFlickerTestsDesktopMode-maximize-MaximizeAppWindowWithDragToTopDragZoneInDesktopFirstFlickerTest",
    base: "WMShellFlickerTestsDesktopMode",
    test_suites: ["device-tests"],
    include_filters: ["com.android.wm.shell.flicker.maximize.MaximizeAppWindowWithDragToTopDragZoneInDesktopFirstFlickerTest"],
}

test_module_config {
    name: "WMShellFlickerTestsDesktopMode-minimize-MinimizeAppsFlickerTest",
    base: "WMShellFlickerTestsDesktopMode",
+3 −0
Original line number Diff line number Diff line
@@ -75,6 +75,9 @@
    {
      "name": "WMShellFlickerTestsDesktopMode-maximize-MaximizeAppViaHeaderMenuFlickerTest"
    },
    {
      "name": "WMShellFlickerTestsDesktopMode-maximize-MaximizeAppWindowWithDragToTopDragZoneInDesktopFirstFlickerTest"
    },
    {
      "name": "WMShellFlickerTestsDesktopMode-minimize-MinimizeAppsFlickerTest"
    },
+0 −51
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 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.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.wm.shell.flicker.DesktopModeFlickerScenarios.Companion.MAXIMIZE_APP
import com.android.wm.shell.scenarios.MaximizeAppWindowWithDragToTopDragZoneInDesktopFirst
import org.junit.Test
import org.junit.runner.RunWith

/**
 * Maximize app window by dragging it to the top drag zone in desktop-first display.
 *
 * Assert that the app window keeps the same increases in size, filling the vertical and horizontal
 * stable display bounds.
 */
@RequiresDevice
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class MaximizeAppWindowWithDragToTopDragZoneInDesktopFirstPortrait :
    MaximizeAppWindowWithDragToTopDragZoneInDesktopFirst() {
    @ExpectedScenarios(["MAXIMIZE_APP"])
    @Test
    override fun maximizeAppWithDragToTopDragZone() = super.maximizeAppWithDragToTopDragZone()

    companion object {
        @JvmStatic
        @FlickerConfigProvider
        fun flickerConfigProvider(): FlickerConfig =
            FlickerConfig().use(FlickerServiceConfig.DEFAULT).use(MAXIMIZE_APP)
    }
}
 No newline at end of file
+93 −0
Original line number Diff line number Diff line
@@ -14,41 +14,80 @@
 * limitations under the License.
 */

package com.android.wm.shell.flicker

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
package com.android.wm.shell.flicker.maximize

import androidx.test.filters.RequiresDevice
import com.android.wm.shell.flicker.DesktopModeFlickerScenarios.Companion.MAXIMIZE_APP
import android.tools.NavBar
import android.tools.flicker.assertions.FlickerChecker
import android.tools.flicker.junit.FlickerParametersRunnerFactory
import android.tools.flicker.FlickerBuilder
import android.tools.flicker.FlickerTest
import android.tools.flicker.FlickerTestFactory
import com.android.wm.shell.flicker.DesktopModeBaseTest
import com.android.wm.shell.scenarios.MaximizeAppWindowWithDragToTopDragZoneInDesktopFirst
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.runner.RunWith
import org.junit.runners.Parameterized

/**
 * Maximize app window by dragging it to the top drag zone in desktop-first display.
 *
 * Test with 3 button navigation because the expected bottom inset of the stable bounds is higher
 * than actual.
 *
 * Assert that the app window keeps the same increases in size, filling the vertical and horizontal
 * stable display bounds.
 */

@RequiresDevice
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class MaximizeAppWindowWithDragToTopDragZoneInDesktopFirstLandscape :
    MaximizeAppWindowWithDragToTopDragZoneInDesktopFirst(
        rotation = ROTATION_90
    ) {
    @ExpectedScenarios(["MAXIMIZE_APP"])
@RunWith(Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
class MaximizeAppWindowWithDragToTopDragZoneInDesktopFirstFlickerTest(flicker: FlickerTest) :
    DesktopModeBaseTest(flicker) {
    inner class MaximizeAppWindowWithDragToTopDragZoneInDesktopFirstScenario :
        MaximizeAppWindowWithDragToTopDragZoneInDesktopFirst(flicker.scenario.startRotation)

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

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

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

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

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

    companion object {
        @Parameterized.Parameters(name = "{0}")
        @JvmStatic
        @FlickerConfigProvider
        fun flickerConfigProvider(): FlickerConfig =
            FlickerConfig().use(FlickerServiceConfig.DEFAULT).use(MAXIMIZE_APP)
        fun getParams(): Collection<FlickerChecker> {
            return FlickerTestFactory.nonRotationTests(
                supportedNavigationModes = listOf(NavBar.MODE_3BUTTON)
            )
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ abstract class MaximizeAppWindowWithDragToTopDragZoneInDesktopFirst(
    private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
    private val wmHelper = WindowManagerStateHelper(instrumentation)
    private val device = UiDevice.getInstance(instrumentation)
    private val testApp = DesktopModeAppHelper(SimpleAppHelper(instrumentation))
    val testApp = DesktopModeAppHelper(SimpleAppHelper(instrumentation))

    @get:Rule(order = 0)
    val checkFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule()
Loading