Merge "Introduce a subject to assert changes over rectangles" into sc-dev

This commit is contained in:
Nataniel Borges
2021-03-30 12:26:23 +00:00
committed by Android (Google) Code Review
16 changed files with 52 additions and 61 deletions

View File

@@ -73,7 +73,8 @@ fun FlickerTestParameter.dockedStackDividerIsInvisible() {
fun FlickerTestParameter.appPairsPrimaryBoundsIsVisible(rotation: Int, primaryLayerName: String) {
assertLayersEnd {
val dividerRegion = entry.getVisibleBounds(APP_PAIR_SPLIT_DIVIDER)
this.coversExactly(getPrimaryRegion(dividerRegion, rotation), primaryLayerName)
visibleRegion(primaryLayerName)
.coversExactly(getPrimaryRegion(dividerRegion, rotation))
}
}
@@ -83,7 +84,8 @@ fun FlickerTestParameter.dockedStackPrimaryBoundsIsVisible(
) {
assertLayersEnd {
val dividerRegion = entry.getVisibleBounds(DOCKED_STACK_DIVIDER)
this.coversExactly(getPrimaryRegion(dividerRegion, rotation), primaryLayerName)
visibleRegion(primaryLayerName)
.coversExactly(getPrimaryRegion(dividerRegion, rotation))
}
}
@@ -93,7 +95,8 @@ fun FlickerTestParameter.appPairsSecondaryBoundsIsVisible(
) {
assertLayersEnd {
val dividerRegion = entry.getVisibleBounds(APP_PAIR_SPLIT_DIVIDER)
this.coversExactly(getSecondaryRegion(dividerRegion, rotation), secondaryLayerName)
visibleRegion(secondaryLayerName)
.coversExactly(getSecondaryRegion(dividerRegion, rotation))
}
}
@@ -103,7 +106,8 @@ fun FlickerTestParameter.dockedStackSecondaryBoundsIsVisible(
) {
assertLayersEnd {
val dividerRegion = entry.getVisibleBounds(DOCKED_STACK_DIVIDER)
this.coversExactly(getSecondaryRegion(dividerRegion, rotation), secondaryLayerName)
visibleRegion(secondaryLayerName)
.coversExactly(getSecondaryRegion(dividerRegion, rotation))
}
}

View File

@@ -82,10 +82,10 @@ class AppPairsTestPairPrimaryAndSecondaryApps(
fun appsEndingBounds() {
testSpec.assertLayersEnd {
val dividerRegion = entry.getVisibleBounds(APP_PAIR_SPLIT_DIVIDER)
this.coversExactly(appPairsHelper.getPrimaryBounds(dividerRegion),
primaryApp.defaultWindowName)
.coversExactly(appPairsHelper.getSecondaryBounds(dividerRegion),
secondaryApp.defaultWindowName)
visibleRegion(primaryApp.defaultWindowName)
.coversExactly(appPairsHelper.getPrimaryBounds(dividerRegion))
visibleRegion(secondaryApp.defaultWindowName)
.coversExactly(appPairsHelper.getSecondaryBounds(dividerRegion))
}
}

View File

@@ -87,10 +87,10 @@ class AppPairsTestUnpairPrimaryAndSecondaryApps(
fun appsStartingBounds() {
testSpec.assertLayersStart {
val dividerRegion = entry.getVisibleBounds(APP_PAIR_SPLIT_DIVIDER)
coversExactly(appPairsHelper.getPrimaryBounds(dividerRegion),
primaryApp.defaultWindowName)
coversExactly(appPairsHelper.getSecondaryBounds(dividerRegion),
secondaryApp.defaultWindowName)
visibleRegion(primaryApp.defaultWindowName)
.coversExactly(appPairsHelper.getPrimaryBounds(dividerRegion))
visibleRegion(secondaryApp.defaultWindowName)
.coversExactly(appPairsHelper.getSecondaryBounds(dividerRegion))
}
}

View File

@@ -183,8 +183,8 @@ class ResizeLegacySplitScreen(
dividerBounds.bottom - WindowUtils.dockedStackDividerInset,
displayBounds.right,
displayBounds.bottom - WindowUtils.navigationBarHeight)
this.coversExactly(topAppBounds, "SimpleActivity")
.coversExactly(bottomAppBounds, "ImeActivity")
visibleRegion("SimpleActivity").coversExactly(topAppBounds)
visibleRegion("ImeActivity").coversExactly(bottomAppBounds)
}
}
@@ -203,8 +203,8 @@ class ResizeLegacySplitScreen(
displayBounds.right,
displayBounds.bottom - WindowUtils.navigationBarHeight)
this.coversExactly(topAppBounds, sSimpleActivity)
.coversExactly(bottomAppBounds, sImeActivity)
visibleRegion(sSimpleActivity).coversExactly(topAppBounds)
visibleRegion(sImeActivity).coversExactly(bottomAppBounds)
}
}

View File

@@ -90,8 +90,8 @@ class EnterExitPipTest(
@Test
fun testAppCoversFullScreenWithPipOnDisplay() {
testSpec.assertLayersStart {
coversExactly(displayBounds, testApp.defaultWindowName)
coversAtMost(displayBounds, pipApp.defaultWindowName)
visibleRegion(testApp.defaultWindowName).coversExactly(displayBounds)
visibleRegion(pipApp.defaultWindowName).coversAtMost(displayBounds)
}
}
@@ -99,7 +99,7 @@ class EnterExitPipTest(
@Test
fun pipAppCoversFullScreen() {
testSpec.assertLayersEnd {
coversExactly(displayBounds, pipApp.defaultWindowName)
visibleRegion(pipApp.defaultWindowName).coversExactly(displayBounds)
}
}

View File

@@ -116,7 +116,7 @@ class EnterPipToOtherOrientationTest(
@Test
fun pipAppLayerHidesTestApp() {
testSpec.assertLayersStart {
coversExactly(startingBounds, pipApp.defaultWindowName)
visibleRegion(pipApp.defaultWindowName).coversExactly(startingBounds)
isInvisible(testApp.defaultWindowName)
}
}
@@ -125,7 +125,7 @@ class EnterPipToOtherOrientationTest(
@Test
fun testAppLayerCoversFullScreen() {
testSpec.assertLayersEnd {
coversExactly(endingBounds, testApp.defaultWindowName)
visibleRegion(testApp.defaultWindowName).coversExactly(endingBounds)
}
}

View File

@@ -116,8 +116,8 @@ class PipLegacySplitScreenTest(testSpec: FlickerTestParameter) : PipTransition(t
@Test
fun bothAppLayersVisible() {
testSpec.assertLayersEnd {
coversAtMost(displayBounds, testApp.defaultWindowName)
coversAtMost(displayBounds, imeApp.defaultWindowName)
visibleRegion(testApp.defaultWindowName).coversAtMost(displayBounds)
visibleRegion(imeApp.defaultWindowName).coversAtMost(displayBounds)
}
}

View File

@@ -63,7 +63,7 @@ class PipMovesInAllApps(testSpec: FlickerTestParameter) : PipTransition(testSpec
@Test
fun pipLayerInsideDisplay() {
testSpec.assertLayersStart {
coversAtMost(displayBounds, pipApp.defaultWindowName)
visibleRegion(pipApp.defaultWindowName).coversAtMost(displayBounds)
}
}

View File

@@ -26,11 +26,11 @@ import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.endRotation
import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.startRotation
import com.android.wm.shell.flicker.helpers.FixedAppHelper
import com.android.server.wm.flicker.noUncoveredRegions
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.noUncoveredRegions
import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.wm.shell.flicker.helpers.FixedAppHelper
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -91,8 +91,8 @@ class PipRotationTest(testSpec: FlickerTestParameter) : PipTransition(testSpec)
@Test
fun appLayerRotates_StartingBounds() {
testSpec.assertLayersStart {
coversExactly(startingBounds, fixedApp.defaultWindowName)
coversAtMost(startingBounds, pipApp.defaultWindowName)
visibleRegion(fixedApp.defaultWindowName).coversExactly(startingBounds)
visibleRegion(pipApp.defaultWindowName).coversAtMost(startingBounds)
}
}
@@ -100,8 +100,8 @@ class PipRotationTest(testSpec: FlickerTestParameter) : PipTransition(testSpec)
@Test
fun appLayerRotates_EndingBounds() {
testSpec.assertLayersEnd {
coversExactly(endingBounds, fixedApp.defaultWindowName)
coversAtMost(endingBounds, pipApp.defaultWindowName)
visibleRegion(fixedApp.defaultWindowName).coversExactly(endingBounds)
visibleRegion(pipApp.defaultWindowName).coversAtMost(endingBounds)
}
}

View File

@@ -83,7 +83,7 @@ class PipToAppTest(testSpec: FlickerTestParameter) : PipTransition(testSpec) {
@Test
fun testAppCoversFullScreen() {
testSpec.assertLayersStart {
coversExactly(displayBounds, pipApp.defaultWindowName)
visibleRegion(pipApp.defaultWindowName).coversExactly(displayBounds)
}
}

View File

@@ -91,7 +91,7 @@ class SetRequestedOrientationWhilePinnedTest(
@Test
fun pipWindowInsideDisplay() {
testSpec.assertWmStart {
coversAtMost(startingBounds, pipApp.defaultWindowName)
frameRegion(pipApp.defaultWindowName).coversAtMost(startingBounds)
}
}
@@ -107,7 +107,7 @@ class SetRequestedOrientationWhilePinnedTest(
@Test
fun pipLayerInsideDisplay() {
testSpec.assertLayersStart {
coversAtMost(startingBounds, pipApp.defaultWindowName)
visibleRegion(pipApp.defaultWindowName).coversAtMost(startingBounds)
}
}
@@ -121,7 +121,7 @@ class SetRequestedOrientationWhilePinnedTest(
@Test
fun pipAppLayerCoversFullScreen() {
testSpec.assertLayersEnd {
coversExactly(endingBounds, pipApp.defaultWindowName)
visibleRegion(pipApp.defaultWindowName).coversExactly(endingBounds)
}
}

View File

@@ -101,10 +101,10 @@ fun FlickerTestParameter.noUncoveredRegions(
}
} else {
assertLayersStart {
this.coversAtLeast(startingBounds)
this.visibleRegion().coversAtLeast(startingBounds)
}
assertLayersEnd {
this.coversAtLeast(endingBounds)
this.visibleRegion().coversAtLeast(endingBounds)
}
}
}
@@ -152,10 +152,10 @@ fun FlickerTestParameter.navBarLayerRotatesAndScales(
val endingPos = WindowUtils.getNavigationBarPosition(endRotation)
assertLayersStart {
this.coversExactly(startingPos, NAV_BAR_LAYER_NAME)
this.visibleRegion(NAV_BAR_LAYER_NAME).coversExactly(startingPos)
}
assertLayersEnd {
this.coversExactly(endingPos, NAV_BAR_LAYER_NAME)
this.visibleRegion(NAV_BAR_LAYER_NAME).coversExactly(endingPos)
}
}
@@ -168,10 +168,10 @@ fun FlickerTestParameter.statusBarLayerRotatesScales(
val endingPos = WindowUtils.getStatusBarPosition(endRotation)
assertLayersStart {
this.coversExactly(startingPos, STATUS_BAR_WINDOW_NAME)
this.visibleRegion(STATUS_BAR_WINDOW_NAME).coversExactly(startingPos)
}
assertLayersEnd {
this.coversExactly(endingPos, STATUS_BAR_WINDOW_NAME)
this.visibleRegion(STATUS_BAR_WINDOW_NAME).coversExactly(endingPos)
}
}

View File

@@ -19,6 +19,7 @@ package com.android.server.wm.flicker.close
import android.app.Instrumentation
import android.platform.test.annotations.Presubmit
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerBuilderProvider
import com.android.server.wm.flicker.FlickerTestParameter
@@ -87,13 +88,13 @@ abstract class CloseAppTransition(protected val testSpec: FlickerTestParameter)
testSpec.statusBarLayerIsAlwaysVisible()
}
@Presubmit
@FlakyTest
@Test
open fun navBarLayerRotatesAndScales() {
testSpec.navBarLayerRotatesAndScales(testSpec.config.startRotation, Surface.ROTATION_0)
}
@Presubmit
@FlakyTest
@Test
open fun statusBarLayerRotatesScales() {
testSpec.statusBarLayerRotatesScales(testSpec.config.startRotation, Surface.ROTATION_0)

View File

@@ -20,6 +20,7 @@ import android.app.Instrumentation
import android.platform.test.annotations.Presubmit
import android.view.Surface
import android.view.WindowManagerPolicyConstants
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.platform.app.InstrumentationRegistry
import com.android.server.wm.flicker.FlickerBuilderProvider
@@ -134,7 +135,7 @@ class OpenImeWindowTest(private val testSpec: FlickerTestParameter) {
}
}
@Presubmit
@FlakyTest
@Test
fun visibleWindowsShownMoreThanOneConsecutiveEntry() {
testSpec.assertWm {

View File

@@ -24,7 +24,6 @@ import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.SimpleAppHelper
import org.junit.Assume
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -59,20 +58,6 @@ class ChangeAppRotationTest(
super.focusDoesNotChange()
}
@Presubmit
@Test
override fun navBarLayerRotatesAndScales() {
Assume.assumeFalse(testSpec.isRotated)
super.navBarLayerRotatesAndScales()
}
@FlakyTest(bugId = 140855415)
@Test
fun navBarLayerRotatesAndScales_flaky() {
Assume.assumeTrue(testSpec.isRotated)
super.navBarLayerRotatesAndScales()
}
@Presubmit
@Test
fun screenshotLayerBecomesInvisible() {

View File

@@ -139,7 +139,7 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter)
@Test
open fun appLayerRotates_StartingPos() {
testSpec.assertLayersStart {
this.coversExactly(startingPos, testApp.getPackage())
this.visibleRegion(testApp.getPackage()).coversExactly(startingPos)
}
}
@@ -147,7 +147,7 @@ abstract class RotationTransition(protected val testSpec: FlickerTestParameter)
@Test
open fun appLayerRotates_EndingPos() {
testSpec.assertLayersEnd {
this.coversExactly(endingPos, testApp.getPackage())
this.visibleRegion(testApp.getPackage()).coversExactly(endingPos)
}
}
}