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

Commit 02724c04 authored by Ioana Moraru's avatar Ioana Moraru
Browse files

Use the display 0 transform for assertions

The first display is not always display 0. For example screen recording
creates a virtual display to duplicate the screen. The assertions should use data from display 0.

Bug: 188792659
Test: atest FlickerTests
Test: atest WMShellFlickerTests
Change-Id: I45913d1fb688c0d91e53333e3450d47e3f2faf62
parent edd0ff08
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -89,14 +89,14 @@ fun FlickerTestParameter.statusBarLayerIsVisible() {

fun FlickerTestParameter.navBarLayerRotatesAndScales() {
    assertLayersStart {
        val rotation = this.entry.displays.firstOrNull()?.transform?.getRotation()
            ?: Surface.ROTATION_0
        val rotation = this.entry.displays.sortedBy { it.id }
            .firstOrNull()?.transform?.getRotation() ?: Surface.ROTATION_0
        this.visibleRegion(FlickerComponentName.NAV_BAR)
                .coversExactly(WindowUtils.getNavigationBarPosition(rotation))
    }
    assertLayersEnd {
        val rotation = this.entry.displays.firstOrNull()?.transform?.getRotation()
            ?: Surface.ROTATION_0
        val rotation = this.entry.displays.sortedBy { it.id }
            .firstOrNull()?.transform?.getRotation() ?: Surface.ROTATION_0
        this.visibleRegion(FlickerComponentName.NAV_BAR)
                .coversExactly(WindowUtils.getNavigationBarPosition(rotation))
    }
@@ -104,14 +104,14 @@ fun FlickerTestParameter.navBarLayerRotatesAndScales() {

fun FlickerTestParameter.statusBarLayerRotatesScales() {
    assertLayersStart {
        val rotation = this.entry.displays.firstOrNull()?.transform?.getRotation()
            ?: Surface.ROTATION_0
        val rotation = this.entry.displays.sortedBy { it.id }
            .firstOrNull()?.transform?.getRotation() ?: Surface.ROTATION_0
        this.visibleRegion(FlickerComponentName.STATUS_BAR)
            .coversExactly(WindowUtils.getStatusBarPosition(rotation))
    }
    assertLayersEnd {
        val rotation = this.entry.displays.firstOrNull()?.transform?.getRotation()
            ?: Surface.ROTATION_0
        val rotation = this.entry.displays.sortedBy { it.id }
            .firstOrNull()?.transform?.getRotation() ?: Surface.ROTATION_0
        this.visibleRegion(FlickerComponentName.STATUS_BAR)
            .coversExactly(WindowUtils.getStatusBarPosition(rotation))
    }