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
This commit is contained in:
Ioana Moraru
2021-09-17 12:16:14 +00:00
parent edd0ff0865
commit 02724c041f

View File

@@ -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))
}