diff options
| author | 2023-09-20 20:47:38 +0000 | |
|---|---|---|
| committer | 2023-09-20 20:48:49 +0000 | |
| commit | 89ddea905debe0fa445dc4ebad5687705a18b767 (patch) | |
| tree | e6c1b3e6ccfe2a591f6d699391d06a256048b581 | |
| parent | 1c915fde131987da4ea549b1770a8b32a6fc5826 (diff) | |
Fix assertion for entering PiP from landscape split screen
Test: atest AutoEnterPipFromSplitScreenOnGoToHomeTest
Bug: 301107915
Change-Id: I99aea254ec3f87b0b3dfebcc50f0461067718ad6
| -rw-r--r-- | libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/AutoEnterPipFromSplitScreenOnGoToHomeTest.kt | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/AutoEnterPipFromSplitScreenOnGoToHomeTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/AutoEnterPipFromSplitScreenOnGoToHomeTest.kt index b86c98ebde47..03c438f1be86 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/AutoEnterPipFromSplitScreenOnGoToHomeTest.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/AutoEnterPipFromSplitScreenOnGoToHomeTest.kt @@ -23,6 +23,7 @@ import android.tools.device.flicker.junit.FlickerParametersRunnerFactory import android.tools.device.flicker.legacy.FlickerBuilder import android.tools.device.flicker.legacy.LegacyFlickerTest import android.tools.device.flicker.legacy.LegacyFlickerTestFactory +import android.tools.common.flicker.subject.region.RegionTraceSubject import android.tools.device.helpers.WindowUtils import android.tools.device.traces.parsers.toFlickerComponent import androidx.test.filters.RequiresDevice @@ -128,9 +129,20 @@ class AutoEnterPipFromSplitScreenOnGoToHomeTest(flicker: LegacyFlickerTest) : if (tapl.isTablet) { flicker.assertWmVisibleRegion(pipApp) { coversAtMost(displayBounds) } } else { - // on phones home does not rotate in landscape, PiP enters back to portrait - // orientation so use display bounds from that orientation for assertion - flicker.assertWmVisibleRegion(pipApp) { coversAtMost(portraitDisplayBounds) } + // on phones home screen does not rotate in landscape, PiP enters back to portrait + // orientation - if we go from landscape to portrait it should switch between the bounds + // otherwise it should be the same as tablet (i.e. portrait to portrait) + if (flicker.scenario.isLandscapeOrSeascapeAtStart) { + flicker.assertWmVisibleRegion(pipApp) { + // first check against landscape bounds then against portrait bounds + (coversAtMost(displayBounds).then() as RegionTraceSubject).coversAtMost( + portraitDisplayBounds + ) + } + } else { + // always check against the display bounds which do not change during transition + flicker.assertWmVisibleRegion(pipApp) { coversAtMost(displayBounds) } + } } } @@ -139,7 +151,6 @@ class AutoEnterPipFromSplitScreenOnGoToHomeTest(flicker: LegacyFlickerTest) : @JvmStatic fun getParams() = LegacyFlickerTestFactory.nonRotationTests( - supportedRotations = listOf(Rotation.ROTATION_0), // TODO(b/176061063):The 3 buttons of nav bar do not exist in the hierarchy. supportedNavigationModes = listOf(NavBar.MODE_GESTURAL) ) |