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

Commit 2bf00ccc authored by Chilun Huang's avatar Chilun Huang
Browse files

Fix the case that the app doesn't exist

Missing the case that the app doesn't exist. This CL is to fix it.

Bug: 247997619
Test: atest WMShellFlickerTests:EnterSplitScreenByDragFromShortcut

Change-Id: Id9c8c4a41bc049d784a10d9e2720cf636c0ce769
parent 9e28e628
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -45,14 +45,23 @@ fun FlickerTestParameter.appPairsDividerBecomesVisible() {
fun FlickerTestParameter.splitScreenEntered(
    component1: IComponentMatcher,
    component2: IComponentMatcher,
    fromOtherApp: Boolean
    fromOtherApp: Boolean,
    appExistAtStart: Boolean = true
) {
    if (fromOtherApp) {
        if (appExistAtStart) {
            appWindowIsInvisibleAtStart(component1)
        } else {
            appWindowIsNotContainAtStart(component1)
        }
    } else {
        appWindowIsVisibleAtStart(component1)
    }
    if (appExistAtStart) {
        appWindowIsInvisibleAtStart(component2)
    } else {
        appWindowIsNotContainAtStart(component2)
    }
    splitScreenDividerIsInvisibleAtStart()

    appWindowIsVisibleAtEnd(component1)
@@ -315,6 +324,10 @@ fun FlickerTestParameter.appWindowIsInvisibleAtEnd(component: IComponentMatcher)
    assertWmEnd { this.isAppWindowInvisible(component) }
}

fun FlickerTestParameter.appWindowIsNotContainAtStart(component: IComponentMatcher) {
    assertWmStart { this.notContains(component) }
}

fun FlickerTestParameter.appWindowKeepVisible(component: IComponentMatcher) {
    assertWm { this.isAppWindowVisible(component) }
}
+11 −3
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.wm.shell.flicker.appWindowBecomesVisible
import com.android.wm.shell.flicker.appWindowIsVisibleAtEnd
import com.android.wm.shell.flicker.layerBecomesVisible
import com.android.wm.shell.flicker.layerIsVisibleAtEnd
@@ -78,7 +77,8 @@ class EnterSplitScreenByDragFromShortcut(

    @Postsubmit
    @Test
    fun cujCompleted() = testSpec.splitScreenEntered(primaryApp, secondaryApp, fromOtherApp = false)
    fun cujCompleted() = testSpec.splitScreenEntered(primaryApp, secondaryApp,
        fromOtherApp = false, appExistAtStart = false)

    @Postsubmit
    @Test
@@ -108,7 +108,15 @@ class EnterSplitScreenByDragFromShortcut(

    @Postsubmit
    @Test
    fun secondaryAppWindowBecomesVisible() = testSpec.appWindowBecomesVisible(secondaryApp)
    fun secondaryAppWindowBecomesVisible() {
        testSpec.assertWm {
            this.notContains(secondaryApp)
                .then()
                .isAppWindowInvisible(secondaryApp, isOptional = true)
                .then()
                .isAppWindowVisible(secondaryApp)
        }
    }

    /** {@inheritDoc} */
    @Postsubmit