Use display information from layers trace on assertions
Displays were added to the SF trace. Parse them on flicker and use during entireScreenCovered assertion instead of estimating coordinates based on the screen rotation. Bug: 188792659 Test: atest FlickerTests Change-Id: I5e01979e17a28a8ff83814bc43bf6ed91b5626a8
This commit is contained in:
@@ -104,7 +104,7 @@ class LegacySplitScreenToLauncher(
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun entireScreenCovered() = testSpec.entireScreenCovered(testSpec.config.endRotation)
|
||||
fun entireScreenCovered() = testSpec.entireScreenCovered()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
|
||||
@@ -28,7 +28,6 @@ import com.android.server.wm.flicker.annotation.Group2
|
||||
import com.android.server.wm.flicker.dsl.FlickerBuilder
|
||||
import com.android.server.wm.flicker.entireScreenCovered
|
||||
import com.android.server.wm.flicker.helpers.launchSplitScreen
|
||||
import com.android.server.wm.flicker.startRotation
|
||||
import com.android.server.wm.flicker.statusBarLayerIsVisible
|
||||
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
|
||||
import com.android.wm.shell.flicker.appPairsDividerBecomesVisible
|
||||
@@ -77,7 +76,7 @@ class OpenAppToLegacySplitScreen(
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun entireScreenCovered() = testSpec.entireScreenCovered(testSpec.config.startRotation)
|
||||
fun entireScreenCovered() = testSpec.entireScreenCovered()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
|
||||
@@ -129,7 +129,7 @@ class ResizeLegacySplitScreen(
|
||||
fun statusBarLayerIsVisible() = testSpec.statusBarLayerIsVisible()
|
||||
|
||||
@Test
|
||||
fun entireScreenCovered() = testSpec.entireScreenCovered(testSpec.config.endRotation)
|
||||
fun entireScreenCovered() = testSpec.entireScreenCovered()
|
||||
|
||||
@Test
|
||||
fun navBarLayerRotatesAndScales() =
|
||||
|
||||
@@ -126,11 +126,12 @@ class EnterPipToOtherOrientationTest(
|
||||
|
||||
/**
|
||||
* Checks that all parts of the screen are covered at the start and end of the transition
|
||||
*
|
||||
* TODO b/197726599 Prevents all states from being checked
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
override fun entireScreenCovered() =
|
||||
testSpec.entireScreenCovered(Surface.ROTATION_90, Surface.ROTATION_0, allStates = false)
|
||||
override fun entireScreenCovered() = testSpec.entireScreenCovered(allStates = false)
|
||||
|
||||
/**
|
||||
* Checks [pipApp] window remains visible and on top throughout the transition
|
||||
|
||||
@@ -88,8 +88,7 @@ class PipRotationTest(testSpec: FlickerTestParameter) : PipTransition(testSpec)
|
||||
*/
|
||||
@Presubmit
|
||||
@Test
|
||||
override fun entireScreenCovered() = testSpec.entireScreenCovered(testSpec.config.startRotation,
|
||||
testSpec.config.endRotation, allStates = false)
|
||||
override fun entireScreenCovered() = testSpec.entireScreenCovered()
|
||||
|
||||
/**
|
||||
* Checks the position of the navigation bar at the start and end of the transition
|
||||
|
||||
@@ -187,6 +187,5 @@ abstract class PipTransition(protected val testSpec: FlickerTestParameter) {
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun entireScreenCovered() =
|
||||
testSpec.entireScreenCovered(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
open fun entireScreenCovered() = testSpec.entireScreenCovered()
|
||||
}
|
||||
@@ -144,9 +144,7 @@ class SetRequestedOrientationWhilePinnedTest(
|
||||
|
||||
@FlakyTest
|
||||
@Test
|
||||
override fun entireScreenCovered() {
|
||||
super.entireScreenCovered()
|
||||
}
|
||||
override fun entireScreenCovered() = super.entireScreenCovered()
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
|
||||
@@ -36,30 +36,35 @@ fun FlickerTestParameter.navBarWindowIsVisible() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If [allStates] is true, checks if the stack space of all displays is fully covered
|
||||
* by any visible layer, during the whole transitions
|
||||
*
|
||||
* Otherwise, checks if the stack space of all displays is fully covered
|
||||
* by any visible layer, at the start and end of the transition
|
||||
*
|
||||
* @param allStates if all states should be checked, othersie, just initial and final
|
||||
*/
|
||||
@JvmOverloads
|
||||
fun FlickerTestParameter.entireScreenCovered(
|
||||
beginRotation: Int,
|
||||
endRotation: Int = beginRotation,
|
||||
allStates: Boolean = true
|
||||
) {
|
||||
val startingBounds = WindowUtils.getDisplayBounds(beginRotation)
|
||||
val endingBounds = WindowUtils.getDisplayBounds(endRotation)
|
||||
fun FlickerTestParameter.entireScreenCovered(allStates: Boolean = true) {
|
||||
if (allStates) {
|
||||
assertLayers {
|
||||
if (startingBounds == endingBounds) {
|
||||
this.coversAtLeast(startingBounds)
|
||||
} else {
|
||||
this.coversAtLeast(startingBounds)
|
||||
.then()
|
||||
.coversAtLeast(endingBounds)
|
||||
this.invoke("entireScreenCovered") { entry ->
|
||||
entry.entry.displays.forEach { display ->
|
||||
entry.visibleRegion().coversAtLeast(display.layerStackSpace)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
assertLayersStart {
|
||||
this.visibleRegion().coversAtLeast(startingBounds)
|
||||
this.entry.displays.forEach { display ->
|
||||
this.visibleRegion().coversAtLeast(display.layerStackSpace)
|
||||
}
|
||||
}
|
||||
assertLayersEnd {
|
||||
this.visibleRegion().coversAtLeast(endingBounds)
|
||||
this.entry.displays.forEach { display ->
|
||||
this.visibleRegion().coversAtLeast(display.layerStackSpace)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,9 +123,7 @@ abstract class CloseAppTransition(protected val testSpec: FlickerTestParameter)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun entireScreenCovered() {
|
||||
testSpec.entireScreenCovered(testSpec.config.startRotation, Surface.ROTATION_0)
|
||||
}
|
||||
open fun entireScreenCovered() = testSpec.entireScreenCovered()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
|
||||
@@ -119,7 +119,7 @@ class CloseImeAutoOpenWindowToAppTest(private val testSpec: FlickerTestParameter
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun entireScreenCovered() = testSpec.entireScreenCovered(testSpec.config.startRotation)
|
||||
fun entireScreenCovered() = testSpec.entireScreenCovered()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
|
||||
@@ -116,8 +116,7 @@ class CloseImeAutoOpenWindowToHomeTest(private val testSpec: FlickerTestParamete
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun entireScreenCovered() = testSpec.entireScreenCovered(testSpec.config.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
fun entireScreenCovered() = testSpec.entireScreenCovered()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
|
||||
@@ -115,7 +115,7 @@ class CloseImeWindowToAppTest(private val testSpec: FlickerTestParameter) {
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun entireScreenCovered() = testSpec.entireScreenCovered(testSpec.config.startRotation)
|
||||
fun entireScreenCovered() = testSpec.entireScreenCovered()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
|
||||
@@ -125,8 +125,7 @@ class CloseImeWindowToHomeTest(private val testSpec: FlickerTestParameter) {
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun entireScreenCovered() = testSpec.entireScreenCovered(testSpec.config.startRotation,
|
||||
Surface.ROTATION_0)
|
||||
fun entireScreenCovered() = testSpec.entireScreenCovered()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
|
||||
@@ -108,7 +108,7 @@ class OpenImeWindowTest(private val testSpec: FlickerTestParameter) {
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun entireScreenCovered() = testSpec.entireScreenCovered(testSpec.config.startRotation)
|
||||
fun entireScreenCovered() = testSpec.entireScreenCovered()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
|
||||
@@ -143,8 +143,7 @@ class ReOpenImeWindowTest(private val testSpec: FlickerTestParameter) {
|
||||
@Presubmit
|
||||
@Test
|
||||
// During testing the launcher is always in portrait mode
|
||||
fun entireScreenCovered() = testSpec.entireScreenCovered(testSpec.config.startRotation,
|
||||
testSpec.config.endRotation)
|
||||
fun entireScreenCovered() = testSpec.entireScreenCovered()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
|
||||
@@ -27,7 +27,6 @@ import com.android.server.wm.flicker.FlickerTestParameter
|
||||
import com.android.server.wm.flicker.FlickerTestParameterFactory
|
||||
import com.android.server.wm.flicker.LAUNCHER_COMPONENT
|
||||
import com.android.server.wm.flicker.repetitions
|
||||
import com.android.server.wm.flicker.startRotation
|
||||
import com.android.server.wm.flicker.annotation.Group1
|
||||
import com.android.server.wm.flicker.dsl.FlickerBuilder
|
||||
import com.android.server.wm.flicker.helpers.TwoActivitiesAppHelper
|
||||
@@ -90,9 +89,7 @@ class ActivitiesTransitionTest(val testSpec: FlickerTestParameter) {
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
fun entireScreenCovered() {
|
||||
testSpec.entireScreenCovered(testSpec.config.startRotation)
|
||||
}
|
||||
fun entireScreenCovered() = testSpec.entireScreenCovered()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
|
||||
@@ -138,7 +138,7 @@ class OpenAppNonResizeableTest(testSpec: FlickerTestParameter) : OpenAppTransiti
|
||||
override fun visibleLayersShownMoreThanOneConsecutiveEntry() =
|
||||
super.visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
@FlakyTest
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun entireScreenCovered() = super.entireScreenCovered()
|
||||
|
||||
|
||||
@@ -124,9 +124,7 @@ abstract class OpenAppTransition(protected val testSpec: FlickerTestParameter) {
|
||||
@Presubmit
|
||||
@Test
|
||||
// During testing the launcher is always in portrait mode
|
||||
open fun entireScreenCovered() {
|
||||
testSpec.entireScreenCovered(Surface.ROTATION_0, testSpec.config.endRotation)
|
||||
}
|
||||
open fun entireScreenCovered() = testSpec.entireScreenCovered()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
|
||||
@@ -327,7 +327,7 @@ class QuickSwitchFromLauncherTest(private val testSpec: FlickerTestParameter) {
|
||||
*/
|
||||
@Postsubmit
|
||||
@Test
|
||||
fun screenIsAlwaysFilled() = testSpec.entireScreenCovered(testSpec.config.startRotation)
|
||||
fun screenIsAlwaysFilled() = testSpec.entireScreenCovered()
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.android.server.wm.flicker.FlickerTestParameter
|
||||
import com.android.server.wm.flicker.dsl.FlickerBuilder
|
||||
import com.android.server.wm.flicker.endRotation
|
||||
import com.android.server.wm.flicker.helpers.StandardAppHelper
|
||||
import com.android.server.wm.flicker.helpers.WindowUtils
|
||||
import com.android.server.wm.flicker.helpers.setRotation
|
||||
import com.android.server.wm.flicker.navBarLayerIsVisible
|
||||
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
|
||||
@@ -39,8 +38,6 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter)
|
||||
protected abstract val testApp: StandardAppHelper
|
||||
|
||||
protected val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
protected val startingPos get() = WindowUtils.getDisplayBounds(testSpec.config.startRotation)
|
||||
protected val endingPos get() = WindowUtils.getDisplayBounds(testSpec.config.endRotation)
|
||||
|
||||
protected open val transition: FlickerBuilder.(Map<String, Any?>) -> Unit = {
|
||||
setup {
|
||||
@@ -107,10 +104,7 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter)
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
open fun entireScreenCovered() {
|
||||
testSpec.entireScreenCovered(testSpec.config.startRotation,
|
||||
testSpec.config.endRotation, allStates = false)
|
||||
}
|
||||
open fun entireScreenCovered() = testSpec.entireScreenCovered()
|
||||
|
||||
@Presubmit
|
||||
@Test
|
||||
@@ -124,7 +118,9 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter)
|
||||
@Test
|
||||
open fun appLayerRotates_StartingPos() {
|
||||
testSpec.assertLayersStart {
|
||||
this.visibleRegion(testApp.component).coversExactly(startingPos)
|
||||
this.entry.displays.map { display ->
|
||||
this.visibleRegion(testApp.component).coversExactly(display.layerStackSpace)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +128,9 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter)
|
||||
@Test
|
||||
open fun appLayerRotates_EndingPos() {
|
||||
testSpec.assertLayersEnd {
|
||||
this.visibleRegion(testApp.component).coversExactly(endingPos)
|
||||
this.entry.displays.map { display ->
|
||||
this.visibleRegion(testApp.component).coversExactly(display.layerStackSpace)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,9 +102,11 @@ class SeamlessAppRotationTest(
|
||||
@Test
|
||||
fun appLayerRotates() {
|
||||
testSpec.assertLayers {
|
||||
this.coversExactly(startingPos, testApp.component)
|
||||
.then()
|
||||
.coversExactly(endingPos, testApp.component)
|
||||
this.invoke("entireScreenCovered") { entry ->
|
||||
entry.entry.displays.map { display ->
|
||||
entry.visibleRegion(testApp.component).coversExactly(display.layerStackSpace)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user