diff options
author | 2025-03-13 14:57:35 -0700 | |
---|---|---|
committer | 2025-03-13 14:57:35 -0700 | |
commit | edf584d173f2fbfbfeee3d75aff106e6be1fc20b (patch) | |
tree | 113b01343525e87c10c5da3dabfe53b686d14e66 | |
parent | afcc09c3f1f8c154cdc412101fc0ef4cbb5148f6 (diff) | |
parent | 25b6509df56e5ffbffe745d5657b714ef5c51c3a (diff) |
Merge "Update Flicker tests for divider dragging" into main
2 files changed, 25 insertions, 7 deletions
diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/utils/CommonAssertions.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/utils/CommonAssertions.kt index 509f4f202b6b..8e1cf167318e 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/utils/CommonAssertions.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/utils/CommonAssertions.kt @@ -254,6 +254,16 @@ fun LayersTraceSubject.splitAppLayerBoundsSnapToDivider( } } +/** + * Checks that surfaces are still within the expected region after snapping to a snap point. + * + * @param component The component we are checking (should be one of the two split apps) + * @param landscapePosLeft If [true], and device is in left/right split, app is on the left side of + * the screen. Has no meaning if device is in top/bottom split. + * @param portraitPosTop If [true], and device is in top/bottom split, app is on the top side of + * the screen. Has no meaning if device is in left/right split. + * @param rotation The rotation state of the display. + */ fun LayerTraceEntrySubject.splitAppLayerBoundsSnapToDivider( component: IComponentMatcher, landscapePosLeft: Boolean, @@ -268,10 +278,12 @@ fun LayerTraceEntrySubject.splitAppLayerBoundsSnapToDivider( visibleRegion(component).isNotEmpty() visibleRegion(component) .coversAtMost( + // TODO (b/403082705): Should use the new method for determining left/right split. if (displayBounds.width() > displayBounds.height()) { if (landscapePosLeft) { Region( - 0, + // TODO (b/403304310): Check if we're in an offscreen-enabled mode. + -displayBounds.right, // the receding app can go offscreen 0, (dividerRegion.left + dividerRegion.right) / 2, displayBounds.bottom @@ -280,7 +292,7 @@ fun LayerTraceEntrySubject.splitAppLayerBoundsSnapToDivider( Region( (dividerRegion.left + dividerRegion.right) / 2, 0, - displayBounds.right, + displayBounds.right * 2, // the receding app can go offscreen displayBounds.bottom ) } @@ -288,7 +300,7 @@ fun LayerTraceEntrySubject.splitAppLayerBoundsSnapToDivider( if (portraitPosTop) { Region( 0, - 0, + -displayBounds.bottom, // the receding app can go offscreen displayBounds.right, (dividerRegion.top + dividerRegion.bottom) / 2 ) @@ -297,7 +309,7 @@ fun LayerTraceEntrySubject.splitAppLayerBoundsSnapToDivider( 0, (dividerRegion.top + dividerRegion.bottom) / 2, displayBounds.right, - displayBounds.bottom + displayBounds.bottom * 2 // the receding app can go offscreen ) } } diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/utils/SplitScreenUtils.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/utils/SplitScreenUtils.kt index 49d6877a1654..e4183f16ba14 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/utils/SplitScreenUtils.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/utils/SplitScreenUtils.kt @@ -310,12 +310,18 @@ object SplitScreenUtils { } } + /** + * Drags the divider, then releases, making it snap to a new snap point. + */ fun dragDividerToResizeAndWait(device: UiDevice, wmHelper: WindowManagerStateHelper) { + // Find the first display that is turned on (making the assumption that there is only one). val displayBounds = - wmHelper.currentState.layerState.displays.firstOrNull { !it.isVirtual }?.layerStackSpace - ?: error("Display not found") + wmHelper.currentState.layerState.displays.firstOrNull { !it.isVirtual && it.isOn } + ?.layerStackSpace ?: error("Display not found") val dividerBar = device.wait(Until.findObject(dividerBarSelector), TIMEOUT_MS) - dividerBar.drag(Point(displayBounds.width() * 1 / 3, displayBounds.height() * 2 / 3), 200) + // Drag to a point on the lower left of the screen -- this will cause the divider to snap + // to the left- or bottom-side snap point, shrinking the "primary" test app. + dividerBar.drag(Point(displayBounds.width() * 1 / 4, displayBounds.height() * 3 / 4), 200) wmHelper .StateSyncBuilder() |