Loading libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/CommonAssertions.kt +71 −3 Original line number Diff line number Diff line Loading @@ -44,10 +44,58 @@ fun FlickerTestParameter.appPairsDividerBecomesVisible() { } fun FlickerTestParameter.splitScreenDividerBecomesVisible() { layerBecomesVisible(SPLIT_SCREEN_DIVIDER_COMPONENT) } fun FlickerTestParameter.layerBecomesVisible( component: FlickerComponentName ) { assertLayers { this.isInvisible(SPLIT_SCREEN_DIVIDER_COMPONENT) this.isInvisible(component) .then() .isVisible(SPLIT_SCREEN_DIVIDER_COMPONENT) .isVisible(component) } } fun FlickerTestParameter.layerIsVisibleAtEnd( component: FlickerComponentName ) { assertLayersEnd { this.isVisible(component) } } fun FlickerTestParameter.splitAppLayerBoundsBecomesVisible( rotation: Int, component: FlickerComponentName, splitLeftTop: Boolean ) { assertLayers { this.isInvisible(component) .then() .invoke("splitAppLayerBoundsBecomesVisible") { val dividerRegion = it.layer(SPLIT_SCREEN_DIVIDER_COMPONENT).visibleRegion.region it.visibleRegion(component).overlaps(if (splitLeftTop) { getSplitLeftTopRegion(dividerRegion, rotation) } else { getSplitRightBottomRegion(dividerRegion, rotation) }) } } } fun FlickerTestParameter.splitAppLayerBoundsIsVisibleAtEnd( rotation: Int, component: FlickerComponentName, splitLeftTop: Boolean ) { assertLayersEnd { val dividerRegion = layer(SPLIT_SCREEN_DIVIDER_COMPONENT).visibleRegion.region visibleRegion(component).overlaps(if (splitLeftTop) { getSplitLeftTopRegion(dividerRegion, rotation) } else { getSplitRightBottomRegion(dividerRegion, rotation) }) } } Loading Loading @@ -162,3 +210,23 @@ fun getSecondaryRegion(dividerRegion: Region, rotation: Int): Region { displayBounds.bounds.right, displayBounds.bounds.bottom) } } fun getSplitLeftTopRegion(dividerRegion: Region, rotation: Int): Region { val displayBounds = WindowUtils.getDisplayBounds(rotation) return if (displayBounds.width > displayBounds.height) { Region.from(0, 0, dividerRegion.bounds.left, displayBounds.bounds.bottom) } else { Region.from(0, 0, displayBounds.bounds.right, dividerRegion.bounds.top) } } fun getSplitRightBottomRegion(dividerRegion: Region, rotation: Int): Region { val displayBounds = WindowUtils.getDisplayBounds(rotation) return if (displayBounds.width > displayBounds.height) { Region.from(dividerRegion.bounds.right, 0, displayBounds.bounds.right, displayBounds.bounds.bottom) } else { Region.from(0, dividerRegion.bounds.bottom, displayBounds.bounds.right, displayBounds.bounds.bottom) } } libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenByDragFromAllApps.kt +38 −0 Original line number Diff line number Diff line Loading @@ -24,10 +24,15 @@ import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.annotation.Group1 import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.traces.common.Rect import com.android.wm.shell.flicker.layerBecomesVisible import com.android.wm.shell.flicker.layerIsVisibleAtEnd import com.android.wm.shell.flicker.appWindowBecomesVisible import com.android.wm.shell.flicker.appWindowIsVisibleAtEnd import com.android.wm.shell.flicker.helpers.SplitScreenHelper import com.android.wm.shell.flicker.splitScreenDividerBecomesVisible import com.android.wm.shell.flicker.splitAppLayerBoundsBecomesVisible import com.android.wm.shell.flicker.splitAppLayerBoundsIsVisibleAtEnd import org.junit.Assume import org.junit.Before import org.junit.FixMethodOrder Loading Loading @@ -71,6 +76,11 @@ class EnterSplitScreenByDragFromAllApps( .getAppIcon(secondaryApp.appName) .dragToSplitscreen(secondaryApp.component.packageName, primaryApp.component.packageName) endDisplayBounds = wmHelper.currentState.layerState .displays.firstOrNull { !it.isVirtual } ?.layerStackSpace ?: error("Display not found") } } Loading @@ -78,6 +88,24 @@ class EnterSplitScreenByDragFromAllApps( @Test fun dividerBecomesVisible() = testSpec.splitScreenDividerBecomesVisible() @Presubmit @Test fun primaryAppLayerIsVisibleAtEnd() = testSpec.layerIsVisibleAtEnd(primaryApp.component) @Presubmit @Test fun secondaryAppLayerBecomesVisible() = testSpec.layerBecomesVisible(secondaryApp.component) @Presubmit @Test fun primaryAppBoundsIsVisibleAtEnd() = testSpec.splitAppLayerBoundsIsVisibleAtEnd( testSpec.endRotation, primaryApp.component, isAppLeftTop(true)) @Presubmit @Test fun secondaryAppBoundsBecomesVisible() = testSpec.splitAppLayerBoundsBecomesVisible( testSpec.endRotation, secondaryApp.component, isAppLeftTop(false)) @Presubmit @Test fun primaryAppWindowIsVisibleAtEnd() = testSpec.appWindowIsVisibleAtEnd(primaryApp.component) Loading @@ -87,6 +115,14 @@ class EnterSplitScreenByDragFromAllApps( fun secondaryAppWindowBecomesVisible() = testSpec.appWindowBecomesVisible(secondaryApp.component) private fun isAppLeftTop(primary: Boolean): Boolean { return if (endDisplayBounds.width > endDisplayBounds.height) { !primary } else { primary } } companion object { @Parameterized.Parameters(name = "{0}") @JvmStatic Loading @@ -97,5 +133,7 @@ class EnterSplitScreenByDragFromAllApps( supportedNavigationModes = listOf(WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY)) } private lateinit var endDisplayBounds: Rect } } Loading
libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/CommonAssertions.kt +71 −3 Original line number Diff line number Diff line Loading @@ -44,10 +44,58 @@ fun FlickerTestParameter.appPairsDividerBecomesVisible() { } fun FlickerTestParameter.splitScreenDividerBecomesVisible() { layerBecomesVisible(SPLIT_SCREEN_DIVIDER_COMPONENT) } fun FlickerTestParameter.layerBecomesVisible( component: FlickerComponentName ) { assertLayers { this.isInvisible(SPLIT_SCREEN_DIVIDER_COMPONENT) this.isInvisible(component) .then() .isVisible(SPLIT_SCREEN_DIVIDER_COMPONENT) .isVisible(component) } } fun FlickerTestParameter.layerIsVisibleAtEnd( component: FlickerComponentName ) { assertLayersEnd { this.isVisible(component) } } fun FlickerTestParameter.splitAppLayerBoundsBecomesVisible( rotation: Int, component: FlickerComponentName, splitLeftTop: Boolean ) { assertLayers { this.isInvisible(component) .then() .invoke("splitAppLayerBoundsBecomesVisible") { val dividerRegion = it.layer(SPLIT_SCREEN_DIVIDER_COMPONENT).visibleRegion.region it.visibleRegion(component).overlaps(if (splitLeftTop) { getSplitLeftTopRegion(dividerRegion, rotation) } else { getSplitRightBottomRegion(dividerRegion, rotation) }) } } } fun FlickerTestParameter.splitAppLayerBoundsIsVisibleAtEnd( rotation: Int, component: FlickerComponentName, splitLeftTop: Boolean ) { assertLayersEnd { val dividerRegion = layer(SPLIT_SCREEN_DIVIDER_COMPONENT).visibleRegion.region visibleRegion(component).overlaps(if (splitLeftTop) { getSplitLeftTopRegion(dividerRegion, rotation) } else { getSplitRightBottomRegion(dividerRegion, rotation) }) } } Loading Loading @@ -162,3 +210,23 @@ fun getSecondaryRegion(dividerRegion: Region, rotation: Int): Region { displayBounds.bounds.right, displayBounds.bounds.bottom) } } fun getSplitLeftTopRegion(dividerRegion: Region, rotation: Int): Region { val displayBounds = WindowUtils.getDisplayBounds(rotation) return if (displayBounds.width > displayBounds.height) { Region.from(0, 0, dividerRegion.bounds.left, displayBounds.bounds.bottom) } else { Region.from(0, 0, displayBounds.bounds.right, dividerRegion.bounds.top) } } fun getSplitRightBottomRegion(dividerRegion: Region, rotation: Int): Region { val displayBounds = WindowUtils.getDisplayBounds(rotation) return if (displayBounds.width > displayBounds.height) { Region.from(dividerRegion.bounds.right, 0, displayBounds.bounds.right, displayBounds.bounds.bottom) } else { Region.from(0, dividerRegion.bounds.bottom, displayBounds.bounds.right, displayBounds.bounds.bottom) } }
libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenByDragFromAllApps.kt +38 −0 Original line number Diff line number Diff line Loading @@ -24,10 +24,15 @@ import com.android.server.wm.flicker.FlickerTestParameter import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.annotation.Group1 import com.android.server.wm.flicker.dsl.FlickerBuilder import com.android.server.wm.traces.common.Rect import com.android.wm.shell.flicker.layerBecomesVisible import com.android.wm.shell.flicker.layerIsVisibleAtEnd import com.android.wm.shell.flicker.appWindowBecomesVisible import com.android.wm.shell.flicker.appWindowIsVisibleAtEnd import com.android.wm.shell.flicker.helpers.SplitScreenHelper import com.android.wm.shell.flicker.splitScreenDividerBecomesVisible import com.android.wm.shell.flicker.splitAppLayerBoundsBecomesVisible import com.android.wm.shell.flicker.splitAppLayerBoundsIsVisibleAtEnd import org.junit.Assume import org.junit.Before import org.junit.FixMethodOrder Loading Loading @@ -71,6 +76,11 @@ class EnterSplitScreenByDragFromAllApps( .getAppIcon(secondaryApp.appName) .dragToSplitscreen(secondaryApp.component.packageName, primaryApp.component.packageName) endDisplayBounds = wmHelper.currentState.layerState .displays.firstOrNull { !it.isVirtual } ?.layerStackSpace ?: error("Display not found") } } Loading @@ -78,6 +88,24 @@ class EnterSplitScreenByDragFromAllApps( @Test fun dividerBecomesVisible() = testSpec.splitScreenDividerBecomesVisible() @Presubmit @Test fun primaryAppLayerIsVisibleAtEnd() = testSpec.layerIsVisibleAtEnd(primaryApp.component) @Presubmit @Test fun secondaryAppLayerBecomesVisible() = testSpec.layerBecomesVisible(secondaryApp.component) @Presubmit @Test fun primaryAppBoundsIsVisibleAtEnd() = testSpec.splitAppLayerBoundsIsVisibleAtEnd( testSpec.endRotation, primaryApp.component, isAppLeftTop(true)) @Presubmit @Test fun secondaryAppBoundsBecomesVisible() = testSpec.splitAppLayerBoundsBecomesVisible( testSpec.endRotation, secondaryApp.component, isAppLeftTop(false)) @Presubmit @Test fun primaryAppWindowIsVisibleAtEnd() = testSpec.appWindowIsVisibleAtEnd(primaryApp.component) Loading @@ -87,6 +115,14 @@ class EnterSplitScreenByDragFromAllApps( fun secondaryAppWindowBecomesVisible() = testSpec.appWindowBecomesVisible(secondaryApp.component) private fun isAppLeftTop(primary: Boolean): Boolean { return if (endDisplayBounds.width > endDisplayBounds.height) { !primary } else { primary } } companion object { @Parameterized.Parameters(name = "{0}") @JvmStatic Loading @@ -97,5 +133,7 @@ class EnterSplitScreenByDragFromAllApps( supportedNavigationModes = listOf(WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY)) } private lateinit var endDisplayBounds: Rect } }