Merge "Don't assert bars location when display is off" into tm-dev

This commit is contained in:
Nataniel Borges
2022-04-20 06:28:13 +00:00
committed by Android (Google) Code Review
7 changed files with 95 additions and 15 deletions

View File

@@ -102,28 +102,59 @@ 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))
}
assertLayersEnd {
val display = this.entry.displays.minByOrNull { it.id }
?: throw RuntimeException("There is no display!")
?: throw RuntimeException("There is no display!")
this.visibleRegion(FlickerComponentName.NAV_BAR)
.coversExactly(WindowUtils.getNavigationBarPosition(display))
}
}
fun FlickerTestParameter.statusBarLayerRotatesScales() {
/**
* 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!")
this.visibleRegion(FlickerComponentName.NAV_BAR)
.coversExactly(WindowUtils.getNavigationBarPosition(display))
}
}
/**
* 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

View File

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

View File

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

View File

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

View File

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

View File

@@ -40,6 +40,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:OpenAppFromNotificationWarm`
*/
@RequiresDevice

View File

@@ -16,6 +16,7 @@
package com.android.server.wm.flicker.launch
import android.platform.test.annotations.Postsubmit
import androidx.test.filters.FlakyTest
import android.platform.test.annotations.Presubmit
import android.platform.test.annotations.RequiresDevice
@@ -27,6 +28,7 @@ import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.annotation.Group1
import com.android.server.wm.flicker.helpers.NonResizeableAppHelper
import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.flicker.navBarLayerPositionEnd
import com.android.server.wm.traces.common.FlickerComponentName
import org.junit.FixMethodOrder
import org.junit.Test
@@ -37,6 +39,8 @@ import org.junit.runners.Parameterized
/**
* Test launching an app while the device is locked
*
* This test assumes the device doesn't have AOD enabled
*
* To run this test: `atest FlickerTests:OpenAppNonResizeableTest`
*
* Actions:
@@ -103,8 +107,7 @@ open class OpenAppNonResizeableTest(testSpec: FlickerTestParameter)
/**
* 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 animation is working differently
* in devices with and without blur (b/202936526)
* It is not possible to check at the start because the screen is off
*/
@Presubmit
@Test
@@ -115,7 +118,7 @@ open class OpenAppNonResizeableTest(testSpec: FlickerTestParameter)
}
/** {@inheritDoc} */
@FlakyTest(bugId = 202936526)
@FlakyTest(bugId = 206753786)
@Test
override fun statusBarLayerRotatesScales() = super.statusBarLayerRotatesScales()
@@ -131,10 +134,15 @@ open class OpenAppNonResizeableTest(testSpec: FlickerTestParameter)
}
}
/** {@inheritDoc} */
@FlakyTest
/**
* 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
*/
@Postsubmit
@Test
override fun navBarLayerRotatesAndScales() = super.navBarLayerRotatesAndScales()
override fun navBarLayerRotatesAndScales() = testSpec.navBarLayerPositionEnd()
/** {@inheritDoc} */
@FlakyTest