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

Commit 8e01b90e authored by Daniel Akinola's avatar Daniel Akinola Committed by Android (Google) Code Review
Browse files

Merge "Flicker Tests: Maximizing Resizable & Non Resizable" into main

parents da242e27 0a9cc535
Loading
Loading
Loading
Loading
+41 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.wm.shell.flicker

import android.tools.flicker.AssertionInvocationGroup
import android.tools.flicker.assertors.assertions.AppLayerIncreasesInSize
import android.tools.flicker.assertors.assertions.AppLayerIsInvisibleAtEnd
import android.tools.flicker.assertors.assertions.AppLayerIsVisibleAlways
import android.tools.flicker.assertors.assertions.AppLayerIsVisibleAtStart
@@ -24,6 +25,9 @@ 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.AppWindowHasMaxBoundsInOnlyOneDimension
import android.tools.flicker.assertors.assertions.AppWindowHasMaxDisplayHeight
import android.tools.flicker.assertors.assertions.AppWindowHasMaxDisplayWidth
import android.tools.flicker.assertors.assertions.AppWindowHasSizeOfAtLeast
import android.tools.flicker.assertors.assertions.AppWindowIsInvisibleAtEnd
import android.tools.flicker.assertors.assertions.AppWindowIsVisibleAlways
@@ -243,5 +247,42 @@ class DesktopModeFlickerScenarios {
                    AppWindowReturnsToStartBoundsAndPosition(NON_RESIZABLE_APP)
                ).associateBy({ it }, { AssertionInvocationGroup.BLOCKING }),
            )

        val MAXIMIZE_APP =
            FlickerConfigEntry(
                scenarioId = ScenarioId("MAXIMIZE_APP"),
                extractor =
                TaggedScenarioExtractorBuilder()
                    .setTargetTag(CujType.CUJ_DESKTOP_MODE_MAXIMIZE_WINDOW)
                    .setTransitionMatcher(
                        TaggedCujTransitionMatcher(associatedTransitionRequired = false)
                    )
                    .build(),
                assertions = AssertionTemplates.DESKTOP_MODE_APP_VISIBILITY_ASSERTIONS +
                        listOf(
                            AppLayerIncreasesInSize(DESKTOP_MODE_APP),
                            AppWindowHasMaxDisplayHeight(DESKTOP_MODE_APP),
                            AppWindowHasMaxDisplayWidth(DESKTOP_MODE_APP)
                        ).associateBy({ it }, { AssertionInvocationGroup.BLOCKING }),
            )

        val MAXIMIZE_APP_NON_RESIZABLE =
            FlickerConfigEntry(
                scenarioId = ScenarioId("MAXIMIZE_APP_NON_RESIZABLE"),
                extractor =
                TaggedScenarioExtractorBuilder()
                    .setTargetTag(CujType.CUJ_DESKTOP_MODE_MAXIMIZE_WINDOW)
                    .setTransitionMatcher(
                        TaggedCujTransitionMatcher(associatedTransitionRequired = false)
                    )
                    .build(),
                assertions =
                AssertionTemplates.DESKTOP_MODE_APP_VISIBILITY_ASSERTIONS +
                        listOf(
                            AppLayerIncreasesInSize(DESKTOP_MODE_APP),
                            AppWindowMaintainsAspectRatioAlways(DESKTOP_MODE_APP),
                            AppWindowHasMaxBoundsInOnlyOneDimension(DESKTOP_MODE_APP)
                        ).associateBy({ it }, { AssertionInvocationGroup.BLOCKING }),
            )
    }
}
+50 −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.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 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 pressing the maximize button on the app header.
 *
 * Assert that the app window keeps the same increases in size, filling the vertical and horizontal
 * stable display bounds.
 */
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class MaximizeAppLandscape : MaximizeAppWindow(rotation = ROTATION_90) {
    @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
+53 −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.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 com.android.wm.shell.flicker.DesktopModeFlickerScenarios.Companion.MAXIMIZE_APP_NON_RESIZABLE
import com.android.wm.shell.scenarios.MaximizeAppWindow
import org.junit.Test
import org.junit.runner.RunWith

/**
 * Maximize non-resizable app window by pressing the maximize button on the app header.
 *
 * Assert that the app window keeps the same increases in size, maintaining its aspect ratio, until
 * filling the vertical or horizontal stable display bounds.
 */
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class MaximizeAppNonResizableLandscape : MaximizeAppWindow(
    rotation = ROTATION_90,
    isResizable = false
) {
    @ExpectedScenarios(["MAXIMIZE_APP_NON_RESIZABLE"])
    @Test
    override fun maximizeAppWindow() = super.maximizeAppWindow()


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

/**
 * Maximize non-resizable app window by pressing the maximize button on the app header.
 *
 * Assert that the app window keeps the same increases in size, maintaining its aspect ratio, until
 * filling the vertical or horizontal stable display bounds.
 */
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class MaximizeAppNonResizablePortrait : MaximizeAppWindow(isResizable = false) {
    @ExpectedScenarios(["MAXIMIZE_APP_NON_RESIZABLE"])
    @Test
    override fun maximizeAppWindow() = super.maximizeAppWindow()


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

/**
 * Maximize app window by pressing the maximize button on the app header.
 *
 * Assert that the app window keeps the same increases in size, filling the vertical and horizontal
 * stable display bounds.
 */
@RunWith(FlickerServiceJUnit4ClassRunner::class)
class MaximizeAppPortrait : MaximizeAppWindow() {
    @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