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

Commit 3a3ef059 authored by Nataniel Borges's avatar Nataniel Borges Committed by Automerger Merge Worker
Browse files

Merge "Don't assert bars location when display is off" into tm-dev am: c1655ef3 am: 7222d1ae

parents 174fc632 7222d1ae
Loading
Loading
Loading
Loading
+44 −4
Original line number Diff line number Diff line
@@ -102,13 +102,24 @@ fun FlickerTestParameter.statusBarLayerIsVisible() {
    }
}

fun FlickerTestParameter.navBarLayerRotatesAndScales() {
/**
 * Asserts that the [FlickerComponentName.NAV_BAR] layer is at the correct position at the start
 * of the SF trace
 */
fun FlickerTestParameter.navBarLayerPositionStart() {
    assertLayersStart {
        val display = this.entry.displays.minByOrNull { it.id }
                ?: throw RuntimeException("There is no display!")
        this.visibleRegion(FlickerComponentName.NAV_BAR)
                .coversExactly(WindowUtils.getNavigationBarPosition(display))
    }
}

/**
 * Asserts that the [FlickerComponentName.NAV_BAR] layer is at the correct position at the end
 * of the SF trace
 */
fun FlickerTestParameter.navBarLayerPositionEnd() {
    assertLayersEnd {
        val display = this.entry.displays.minByOrNull { it.id }
                ?: throw RuntimeException("There is no display!")
@@ -117,13 +128,33 @@ fun FlickerTestParameter.navBarLayerRotatesAndScales() {
    }
}

fun FlickerTestParameter.statusBarLayerRotatesScales() {
/**
 * Asserts that the [FlickerComponentName.NAV_BAR] layer is at the correct position at the start
 * and end of the SF trace
 */
fun FlickerTestParameter.navBarLayerRotatesAndScales() {
    navBarLayerPositionStart()
    navBarLayerPositionEnd()
}

/**
 * Asserts that the [FlickerComponentName.STATUS_BAR] layer is at the correct position at the start
 * of the SF trace
 */
fun FlickerTestParameter.statusBarLayerPositionStart() {
    assertLayersStart {
        val display = this.entry.displays.minByOrNull { it.id }
            ?: throw RuntimeException("There is no display!")
        this.visibleRegion(FlickerComponentName.STATUS_BAR)
            .coversExactly(WindowUtils.getStatusBarPosition(display))
    }
}

/**
 * Asserts that the [FlickerComponentName.STATUS_BAR] layer is at the correct position at the end
 * of the SF trace
 */
fun FlickerTestParameter.statusBarLayerPositionEnd() {
    assertLayersEnd {
        val display = this.entry.displays.minByOrNull { it.id }
            ?: throw RuntimeException("There is no display!")
@@ -132,6 +163,15 @@ fun FlickerTestParameter.statusBarLayerRotatesScales() {
    }
}

/**
 * Asserts that the [FlickerComponentName.STATUS_BAR] layer is at the correct position at the start
 * and end of the SF trace
 */
fun FlickerTestParameter.statusBarLayerRotatesScales() {
    statusBarLayerPositionStart()
    statusBarLayerPositionEnd()
}

/**
 * Asserts that:
 *     [originalLayer] is visible at the start of the trace
+2 −0
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@ import org.junit.runners.Parameterized
/**
 * Test cold launching an app from a notification from the lock screen.
 *
 * This test assumes the device doesn't have AOD enabled
 *
 * To run this test: `atest FlickerTests:OpenAppFromLockNotificationCold`
 */
@RequiresDevice
+2 −0
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@ import org.junit.runners.Parameterized
/**
 * Test warm launching an app from a notification from the lock screen.
 *
 * This test assumes the device doesn't have AOD enabled
 *
 * To run this test: `atest FlickerTests:OpenAppFromLockNotificationWarm`
 */
@RequiresDevice
+24 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.platform.test.annotations.Presubmit
import androidx.test.filters.FlakyTest
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.navBarLayerPositionEnd
import com.android.server.wm.traces.common.FlickerComponentName
import org.junit.Test

@@ -99,4 +100,27 @@ abstract class OpenAppFromLockTransition(testSpec: FlickerTestParameter)
    @FlakyTest(bugId = 203538234)
    @Test
    override fun appWindowBecomesVisible() = super.appWindowBecomesVisible()

    /**
     * Checks the position of the navigation bar at the start and end of the transition
     *
     * Differently from the normal usage of this assertion, check only the final state of the
     * transition because the display is off at the start and the NavBar is never visible
     */
    @Presubmit
    @Test
    override fun navBarLayerRotatesAndScales() = testSpec.navBarLayerPositionEnd()

    /**
     * Checks that the status bar layer is visible at the end of the trace
     *
     * It is not possible to check at the start because the screen is off
     */
    @Presubmit
    @Test
    override fun statusBarLayerIsVisible() {
        testSpec.assertLayersEnd {
            this.isVisible(FlickerComponentName.STATUS_BAR)
        }
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@ import org.junit.runners.Parameterized
/**
 * Test cold launching an app from a notification.
 *
 * This test assumes the device doesn't have AOD enabled
 *
 * To run this test: `atest FlickerTests:OpenAppFromNotificationCold`
 */
@RequiresDevice
Loading