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

Commit 3494f795 authored by Yuichiro Hanada's avatar Yuichiro Hanada
Browse files

Add a flicker test for minimizing auto pip app window

Flag: EXEMPT test only change
Bug: 373973157
Test: atest WMShellFlickerTestsDesktopMode:com.android.wm.shell.flicker.MinimizeAutoPipAppWindow
Change-Id: I59a793118b7788dedcbda83ff77375fcac3a395e
parent d30c00eb
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.tools.flicker.assertors.assertions.AppLayerIsVisibleAlways
import android.tools.flicker.assertors.assertions.AppLayerIsVisibleAtStart
import android.tools.flicker.assertors.assertions.AppWindowAlignsWithOnlyOneDisplayCornerAtEnd
import android.tools.flicker.assertors.assertions.AppWindowBecomesInvisible
import android.tools.flicker.assertors.assertions.AppWindowBecomesPinned
import android.tools.flicker.assertors.assertions.AppWindowBecomesTopWindow
import android.tools.flicker.assertors.assertions.AppWindowBecomesVisible
import android.tools.flicker.assertors.assertions.AppWindowCoversLeftHalfScreenAtEnd
@@ -465,5 +466,25 @@ class DesktopModeFlickerScenarios {
                            AppWindowIsVisibleAlways(SIMPLE_APP)
                        ).associateBy({ it }, { AssertionInvocationGroup.BLOCKING }),
            )

        val MINIMIZE_AUTO_PIP_APP =
            FlickerConfigEntry(
                scenarioId = ScenarioId("MINIMIZE_AUTO_PIP_APP"),
                extractor =
                ShellTransitionScenarioExtractor(
                    transitionMatcher =
                    object : ITransitionMatcher {
                        override fun findAll(
                            transitions: Collection<Transition>
                        ): Collection<Transition> =
                            transitions.filter { it.type == TransitionType.PIP }
                    }
                ),
                assertions =
                AssertionTemplates.COMMON_ASSERTIONS +
                    listOf(
                        AppWindowBecomesPinned(DESKTOP_MODE_APP),
                    ).associateBy({ it }, { AssertionInvocationGroup.BLOCKING })
            )
    }
}
+42 −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.MINIMIZE_AUTO_PIP_APP
import com.android.wm.shell.scenarios.MinimizeAutoPipAppWindow
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(FlickerServiceJUnit4ClassRunner::class)
class MinimizeAutoPipAppWindow : MinimizeAutoPipAppWindow() {
    @ExpectedScenarios(["MINIMIZE_AUTO_PIP_APP"])
    @Test
    override fun minimizePipAppWindow() = super.minimizePipAppWindow()

    companion object {
        @JvmStatic
        @FlickerConfigProvider
        fun flickerConfigProvider(): FlickerConfig =
            FlickerConfig().use(FlickerServiceConfig.DEFAULT).use(MINIMIZE_AUTO_PIP_APP)
    }
}