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

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

Merge "b/418236023 Migrate SnapResizeNonResizableAppWindowLeftWithDrag and...

Merge "b/418236023 Migrate SnapResizeNonResizableAppWindowLeftWithDrag and SnapResizeNonResizableAppWindowRightWithDrag to flicker test" into main
parents bccdec5e 625eedfe
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -84,6 +84,8 @@ test_module_config {
        "com.android.wm.shell.flicker.resizing.SnapResizeAppWindowRightWithButtonFlickerTest",
        "com.android.wm.shell.flicker.resizing.SnapResizeAppWindowRightWithDragFlickerTest",
        "com.android.wm.shell.flicker.resizing.SnapResizeAppWindowRightWithKeyboardFlickerTest",
        "com.android.wm.shell.flicker.resizing.SnapResizeNonResizableAppWindowLeftWithDragFlickerTest",
        "com.android.wm.shell.flicker.resizing.SnapResizeNonResizableAppWindowRightWithDragFlickerTest",
        "com.android.wm.shell.flicker.tiling.TilingDividerResizingAppsFlickerTest",
        "com.android.wm.shell.flicker.tiling.TilingDividerShownAfterHomeSwipeFlickerTest",
        "com.android.wm.shell.flicker.tiling.TilingDividerShownAfterOverviewFlickerTest",
@@ -386,6 +388,20 @@ test_module_config {
    include_filters: ["com.android.wm.shell.flicker.resizing.SnapResizeAppWindowRightWithKeyboardFlickerTest"],
}

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

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

test_module_config {
    name: "WMShellFlickerTestsDesktopMode-tiling-TilingDividerResizingAppsFlickerTest",
    base: "WMShellFlickerTestsDesktopMode",
+6 −0
Original line number Diff line number Diff line
@@ -126,6 +126,12 @@
    {
      "name": "WMShellFlickerTestsDesktopMode-resizing-SnapResizeAppWindowRightWithKeyboardFlickerTest"
    },
    {
      "name": "WMShellFlickerTestsDesktopMode-resizing-SnapResizeNonResizableAppWindowLeftWithDragFlickerTest"
    },
    {
      "name": "WMShellFlickerTestsDesktopMode-resizing-SnapResizeNonResizableAppWindowRightWithDragFlickerTest"
    },
    {
      "name": "WMShellFlickerTestsDesktopMode-tiling-TilingDividerResizingAppsFlickerTest"
    },
+0 −51
Original line number 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.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.SNAP_RESIZE_WITH_DRAG_NON_RESIZABLE
import com.android.wm.shell.scenarios.SnapResizeAppWindowWithDrag
import org.junit.Test
import org.junit.runner.RunWith

/**
 * Snap resize non-resizable app window by dragging it to the left edge of the screen.
 *
 * Assert that the app window keeps the same size and returns to its original pre-drag position.
 */
@RequiresDevice
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class SnapResizeNonResizableAppWindowLeftWithDrag :
    SnapResizeAppWindowWithDrag(toLeft = true, isResizable = false) {
    @ExpectedScenarios(["SNAP_RESIZE_WITH_DRAG_NON_RESIZABLE"])
    @Test
    override fun snapResizeAppWindowWithDrag() = super.snapResizeAppWindowWithDrag()

    companion object {
        @JvmStatic
        @FlickerConfigProvider
        fun flickerConfigProvider(): FlickerConfig =
            FlickerConfig().use(FlickerServiceConfig.DEFAULT)
                .use(SNAP_RESIZE_WITH_DRAG_NON_RESIZABLE)
    }
}
 No newline at end of file
+0 −51
Original line number 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.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.SNAP_RESIZE_WITH_DRAG_NON_RESIZABLE
import com.android.wm.shell.scenarios.SnapResizeAppWindowWithDrag
import org.junit.Test
import org.junit.runner.RunWith

/**
 * Snap resize non-resizable app window by dragging it to the right edge of the screen.
 *
 * Assert that the app window keeps the same size and returns to its original pre-drag position.
 */
@RequiresDevice
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class SnapResizeNonResizableAppWindowRightWithDrag :
    SnapResizeAppWindowWithDrag(toLeft = false, isResizable = false) {
    @ExpectedScenarios(["SNAP_RESIZE_WITH_DRAG_NON_RESIZABLE"])
    @Test
    override fun snapResizeAppWindowWithDrag() = super.snapResizeAppWindowWithDrag()

    companion object {
        @JvmStatic
        @FlickerConfigProvider
        fun flickerConfigProvider(): FlickerConfig =
            FlickerConfig().use(FlickerServiceConfig.DEFAULT)
                .use(SNAP_RESIZE_WITH_DRAG_NON_RESIZABLE)
    }
}
 No newline at end of file
+109 −0
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.resizing

import androidx.test.filters.RequiresDevice
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.Utils
import com.android.wm.shell.flicker.DesktopModeBaseTest
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

import com.android.wm.shell.flicker.utils.appWindowKeepVisible
import com.android.wm.shell.flicker.utils.appWindowOnTopAtEnd
import com.android.wm.shell.flicker.utils.appWindowInsideDisplayBoundsAtEnd
import com.android.wm.shell.flicker.utils.appLayerMaintainsAspectRatioAlways
import com.android.wm.shell.flicker.utils.appWindowReturnsToStartBoundsAndPosition
import com.android.wm.shell.scenarios.SnapResizeAppWindowWithDrag


/**
 * Snap resize non-resizable app window by dragging it to the left edge of the screen.
 *
 * Assert that the app window keeps the same size and returns to its original pre-drag position.
 */
@RequiresDevice
@RunWith(value = Parameterized::class)
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
class SnapResizeNonResizableAppWindowLeftWithDragFlickerTest(flicker: FlickerTest) : DesktopModeBaseTest(
    flicker
) {


    inner class SnapResizeNonResizableAppWindowLeftWithDragScenario : SnapResizeAppWindowWithDrag(
        toLeft = true,
        rotation = flicker.scenario.startRotation,
        isResizable = false
    )

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

    private val testApp = scenario.testApp

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

    @Test
    fun appWindowIsVisibleAlways() =
        flicker.appWindowKeepVisible(testApp)

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

    @Test
    fun appWindowRemainInsideDisplayBounds() =
        flicker.appWindowInsideDisplayBoundsAtEnd(testApp)

    @Test
    fun appWindowMaintainsAspectRatioAlways() =
        flicker.appLayerMaintainsAspectRatioAlways(testApp)

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

    companion object {
        @Parameterized.Parameters(name = "{0}")
        @JvmStatic
        fun getParams(): Collection<FlickerChecker> {
            return FlickerTestFactory.nonRotationTests(
                supportedNavigationModes = listOf(NavBar.MODE_GESTURAL)
            )
        }
    }
}
 No newline at end of file
Loading