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

Commit 626522d7 authored by Tracy Zhou's avatar Tracy Zhou
Browse files

Update ReOpenImeWindowTest to be in gestural nav mode

- and update some test assumptions accordingly (live tile)

Bug: 185934639
Test: ReOpenImeWindowTest
Change-Id: If6f40dce174bef5ccc3c3731764607a5826b4762
parent 5b8428fa
Loading
Loading
Loading
Loading
+51 −0
Original line number Diff line number Diff line
@@ -21,6 +21,22 @@ import com.android.server.wm.flicker.FlickerTestParameter

const val IME_WINDOW_TITLE = "InputMethod"

fun FlickerTestParameter.imeLayerIsAlwaysVisible(rotatesScreen: Boolean = false) {
    if (rotatesScreen) {
        assertLayers {
            this.isVisible(IME_WINDOW_TITLE)
                .then()
                .isInvisible(IME_WINDOW_TITLE)
                .then()
                .isVisible(IME_WINDOW_TITLE)
        }
    } else {
        assertLayers {
            this.isVisible(IME_WINDOW_TITLE)
        }
    }
}

fun FlickerTestParameter.imeLayerBecomesVisible() {
    assertLayers {
        this.isInvisible(IME_WINDOW_TITLE)
@@ -49,6 +65,22 @@ fun FlickerTestParameter.imeAppWindowIsAlwaysVisible(testApp: IAppHelper) {
    }
}

fun FlickerTestParameter.imeWindowIsAlwaysVisible(rotatesScreen: Boolean = false) {
    if (rotatesScreen) {
        assertWm {
            this.showsNonAppWindow(IME_WINDOW_TITLE)
                .then()
                .hidesNonAppWindow(IME_WINDOW_TITLE)
                .then()
                .showsNonAppWindow(IME_WINDOW_TITLE)
        }
    } else {
        assertWm {
            this.showsNonAppWindow(IME_WINDOW_TITLE)
        }
    }
}

fun FlickerTestParameter.imeWindowBecomesVisible() {
    assertWm {
        this.hidesNonAppWindow(IME_WINDOW_TITLE)
@@ -65,6 +97,25 @@ fun FlickerTestParameter.imeWindowBecomesInvisible() {
    }
}

fun FlickerTestParameter.imeAppWindowIsAlwaysVisible(
    testApp: IAppHelper,
    rotatesScreen: Boolean = false
) {
    if (rotatesScreen) {
        assertWm {
            this.showsAppWindow(testApp.getPackage())
                .then()
                .hidesAppWindow(testApp.getPackage())
                .then()
                .showsAppWindow(testApp.getPackage())
        }
    } else {
        assertWm {
            this.showsAppWindow(testApp.getPackage())
        }
    }
}

fun FlickerTestParameter.imeAppWindowBecomesVisible(windowName: String) {
    assertWm {
        this.hidesAppWindow(windowName)
+4 −5
Original line number Diff line number Diff line
@@ -112,12 +112,11 @@ class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) {

    @Presubmit
    @Test
    fun imeWindowBecomesVisible() = testSpec.imeWindowBecomesVisible()
    fun imeWindowIsAlwaysVisible() = testSpec.imeWindowIsAlwaysVisible(true)

    @Presubmit
    @Test
    fun imeAppWindowBecomesVisible() =
        testSpec.imeAppWindowBecomesVisible(testAppComponentName.className)
    fun imeAppWindowIsAlwaysVisible() = testSpec.imeAppWindowIsAlwaysVisible(testApp, true)

    @Presubmit
    @Test
@@ -135,7 +134,7 @@ class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) {

    @Presubmit
    @Test
    fun imeLayerBecomesVisible() = testSpec.imeLayerBecomesVisible()
    fun imeLayerIsAlwaysVisible() = testSpec.imeLayerIsAlwaysVisible(true)

    @Presubmit
    @Test
@@ -171,7 +170,7 @@ class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) {
                    repetitions = 1,
                    supportedRotations = listOf(Surface.ROTATION_0),
                    supportedNavigationModes = listOf(
                        WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY
                        WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY
                    )
                )
        }