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

Commit 75a4fd1d authored by dakinola's avatar dakinola Committed by Daniel Akinola
Browse files

Flicker Tests: Snap Resizing

Test: atest SnapResizeAppWindowLeftWithDrag
Bug: 358327087
Flag: TEST_ONLY
Change-Id: I12e24a742868142bfa6fa9e9bcce733ce9929fa9
parent 90c553fe
Loading
Loading
Loading
Loading
+119 −57
Original line number Diff line number Diff line
@@ -21,6 +21,8 @@ import android.tools.flicker.assertors.assertions.AppLayerIsInvisibleAtEnd
import android.tools.flicker.assertors.assertions.AppLayerIsVisibleAlways
import android.tools.flicker.assertors.assertions.AppLayerIsVisibleAtStart
import android.tools.flicker.assertors.assertions.AppWindowBecomesVisible
import android.tools.flicker.assertors.assertions.AppWindowCoversLeftHalfScreenAtEnd
import android.tools.flicker.assertors.assertions.AppWindowCoversRightHalfScreenAtEnd
import android.tools.flicker.assertors.assertions.AppWindowHasDesktopModeInitialBoundsAtTheEnd
import android.tools.flicker.assertors.assertions.AppWindowHasSizeOfAtLeast
import android.tools.flicker.assertors.assertions.AppWindowIsInvisibleAtEnd
@@ -163,6 +165,66 @@ class DesktopModeFlickerScenarios {
                            .associateBy({ it }, { AssertionInvocationGroup.BLOCKING }),
            )

        val SNAP_RESIZE_LEFT_WITH_BUTTON =
            FlickerConfigEntry(
                scenarioId = ScenarioId("SNAP_RESIZE_LEFT_WITH_BUTTON"),
                extractor =
                TaggedScenarioExtractorBuilder()
                    .setTargetTag(CujType.CUJ_DESKTOP_MODE_SNAP_RESIZE)
                    .setTransitionMatcher(
                        TaggedCujTransitionMatcher(associatedTransitionRequired = false)
                    )
                    .build(),
                assertions = AssertionTemplates.DESKTOP_MODE_APP_VISIBILITY_ASSERTIONS +
                        listOf(AppWindowCoversLeftHalfScreenAtEnd(DESKTOP_MODE_APP))
                            .associateBy({ it }, { AssertionInvocationGroup.BLOCKING }),
            )

        val SNAP_RESIZE_RIGHT_WITH_BUTTON =
            FlickerConfigEntry(
                scenarioId = ScenarioId("SNAP_RESIZE_RIGHT_WITH_BUTTON"),
                extractor =
                TaggedScenarioExtractorBuilder()
                    .setTargetTag(CujType.CUJ_DESKTOP_MODE_SNAP_RESIZE)
                    .setTransitionMatcher(
                        TaggedCujTransitionMatcher(associatedTransitionRequired = false)
                    )
                    .build(),
                assertions = AssertionTemplates.DESKTOP_MODE_APP_VISIBILITY_ASSERTIONS +
                        listOf(AppWindowCoversRightHalfScreenAtEnd(DESKTOP_MODE_APP))
                            .associateBy({ it }, { AssertionInvocationGroup.BLOCKING }),
            )

        val SNAP_RESIZE_LEFT_WITH_DRAG =
            FlickerConfigEntry(
                scenarioId = ScenarioId("SNAP_RESIZE_LEFT_WITH_DRAG"),
                extractor =
                TaggedScenarioExtractorBuilder()
                    .setTargetTag(CujType.CUJ_DESKTOP_MODE_SNAP_RESIZE)
                    .setTransitionMatcher(
                        TaggedCujTransitionMatcher(associatedTransitionRequired = false)
                    )
                    .build(),
                assertions = AssertionTemplates.DESKTOP_MODE_APP_VISIBILITY_ASSERTIONS +
                        listOf(AppWindowCoversLeftHalfScreenAtEnd(DESKTOP_MODE_APP))
                            .associateBy({ it }, { AssertionInvocationGroup.BLOCKING }),
            )

        val SNAP_RESIZE_RIGHT_WITH_DRAG =
            FlickerConfigEntry(
                scenarioId = ScenarioId("SNAP_RESIZE_RIGHT_WITH_DRAG"),
                extractor =
                TaggedScenarioExtractorBuilder()
                    .setTargetTag(CujType.CUJ_DESKTOP_MODE_SNAP_RESIZE)
                    .setTransitionMatcher(
                        TaggedCujTransitionMatcher(associatedTransitionRequired = false)
                    )
                    .build(),
                assertions = AssertionTemplates.DESKTOP_MODE_APP_VISIBILITY_ASSERTIONS +
                        listOf(AppWindowCoversRightHalfScreenAtEnd(DESKTOP_MODE_APP))
                            .associateBy({ it }, { AssertionInvocationGroup.BLOCKING }),
            )

        val SNAP_RESIZE_WITH_DRAG_NON_RESIZABLE =
            FlickerConfigEntry(
                scenarioId = ScenarioId("SNAP_RESIZE_WITH_DRAG_NON_RESIZABLE"),
+47 −0
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 com.android.wm.shell.flicker.DesktopModeFlickerScenarios.Companion.SNAP_RESIZE_LEFT_WITH_BUTTON
import com.android.wm.shell.scenarios.SnapResizeAppWindowWithButton
import org.junit.Test
import org.junit.runner.RunWith

/**
 * Snap resize app window using the Snap Left button from the maximize menu.
 *
 * Assert that the app window fills the left half the display after being snap resized.
 */
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class SnapResizeAppWindowLeftWithButton : SnapResizeAppWindowWithButton(toLeft = true) {
    @ExpectedScenarios(["SNAP_RESIZE_LEFT_WITH_BUTTON"])
    @Test
    override fun snapResizeAppWindowWithButton() = super.snapResizeAppWindowWithButton()

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

/**
 * Snap resize app window by dragging it to the left edge of the screen.
 *
 * Assert that the app window fills the left half the display after being snap resized.
 */
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class SnapResizeAppWindowLeftWithDrag : SnapResizeAppWindowWithDrag(toLeft = true) {
    @ExpectedScenarios(["SNAP_RESIZE_LEFT_WITH_DRAG"])
    @Test
    override fun snapResizeAppWindowWithDrag() = super.snapResizeAppWindowWithDrag()

    companion object {
        @JvmStatic
        @FlickerConfigProvider
        fun flickerConfigProvider(): FlickerConfig =
            FlickerConfig().use(FlickerServiceConfig.DEFAULT).use(SNAP_RESIZE_LEFT_WITH_DRAG)
    }
}
 No newline at end of file
+47 −0
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 com.android.wm.shell.flicker.DesktopModeFlickerScenarios.Companion.SNAP_RESIZE_RIGHT_WITH_BUTTON
import com.android.wm.shell.scenarios.SnapResizeAppWindowWithButton
import org.junit.Test
import org.junit.runner.RunWith

/**
 * Snap resize app window using the Snap Right button from the maximize menu.
 *
 * Assert that the app window fills the right half the display after being snap resized.
 */
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class SnapResizeAppWindowRightWithButton : SnapResizeAppWindowWithButton(toLeft = false) {
    @ExpectedScenarios(["SNAP_RESIZE_RIGHT_WITH_BUTTON"])
    @Test
    override fun snapResizeAppWindowWithButton() = super.snapResizeAppWindowWithButton()

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

/**
 * Snap resize app window by dragging it to the right edge of the screen.
 *
 * Assert that the app window fills the right half the display after being snap resized.
 */
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class SnapResizeAppWindowRightWithDrag : SnapResizeAppWindowWithDrag(toLeft = false) {
    @ExpectedScenarios(["SNAP_RESIZE_RIGHT_WITH_DRAG"])
    @Test
    override fun snapResizeAppWindowWithDrag() = super.snapResizeAppWindowWithDrag()

    companion object {
        @JvmStatic
        @FlickerConfigProvider
        fun flickerConfigProvider(): FlickerConfig =
            FlickerConfig().use(FlickerServiceConfig.DEFAULT).use(SNAP_RESIZE_RIGHT_WITH_DRAG)
    }
}
 No newline at end of file