Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 648e45a0 authored by Bryce Lee's avatar Bryce Lee
Browse files

Consider full swipe for gesture exclusion tests.

When full swipe is enable, the top region of the screen is not excluded
from swipes. This changelist updates tests to properly reflect this.

Test: atest GlanceableHubContainerControllerTest
Bug: 358431833
Flag: EXEMPT bugfix
Change-Id: Icfa603c13bb4913eaf8bb4f4f4edc58db68213da
parent 5c11f930
Loading
Loading
Loading
Loading
+87 −1
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import androidx.test.filters.SmallTest
import com.android.compose.animation.scene.SceneKey
import com.android.systemui.Flags
import com.android.systemui.Flags.FLAG_GLANCEABLE_HUB_BACK_GESTURE
import com.android.systemui.Flags.FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX
import com.android.systemui.SysuiTestCase
import com.android.systemui.ambient.touch.TouchHandler
import com.android.systemui.ambient.touch.TouchMonitor
@@ -425,7 +426,7 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() {
        }

    @Test
    @DisableFlags(FLAG_GLANCEABLE_HUB_BACK_GESTURE)
    @DisableFlags(FLAG_GLANCEABLE_HUB_BACK_GESTURE, FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX)
    fun gestureExclusionZone_setAfterInit() =
        with(kosmos) {
            testScope.runTest {
@@ -452,6 +453,27 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() {

    @Test
    @DisableFlags(FLAG_GLANCEABLE_HUB_BACK_GESTURE)
    @EnableFlags(FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX)
    fun gestureExclusionZone_setAfterInit_fullSwipe() =
        with(kosmos) {
            testScope.runTest {
                whenever(containerView.layoutDirection).thenReturn(View.LAYOUT_DIRECTION_LTR)
                goToScene(CommunalScenes.Communal)

                assertThat(containerView.systemGestureExclusionRects)
                    .containsExactly(
                        Rect(
                            /* left= */ 0,
                            /* top= */ 0,
                            /* right= */ 0,
                            /* bottom= */ CONTAINER_HEIGHT
                        )
                    )
            }
        }

    @Test
    @DisableFlags(FLAG_GLANCEABLE_HUB_BACK_GESTURE, FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX)
    fun gestureExclusionZone_setAfterInit_rtl() =
        with(kosmos) {
            testScope.runTest {
@@ -476,8 +498,29 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() {
            }
        }

    @DisableFlags(FLAG_GLANCEABLE_HUB_BACK_GESTURE)
    @EnableFlags(FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX)
    fun gestureExclusionZone_setAfterInit_rtl_fullSwipe() =
        with(kosmos) {
            testScope.runTest {
                whenever(containerView.layoutDirection).thenReturn(View.LAYOUT_DIRECTION_RTL)
                goToScene(CommunalScenes.Communal)

                assertThat(containerView.systemGestureExclusionRects)
                    .containsExactly(
                        Rect(
                            /* left= */ 0,
                            /* top= */ 0,
                            /* right= */ CONTAINER_WIDTH,
                            /* bottom= */ CONTAINER_HEIGHT
                        )
                    )
            }
        }

    @Test
    @EnableFlags(FLAG_GLANCEABLE_HUB_BACK_GESTURE)
    @DisableFlags(FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX)
    fun gestureExclusionZone_setAfterInit_backGestureEnabled() =
        with(kosmos) {
            testScope.runTest {
@@ -502,8 +545,29 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() {
            }
        }

    @Test
    @EnableFlags(FLAG_GLANCEABLE_HUB_BACK_GESTURE, FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX)
    fun gestureExclusionZone_setAfterInit_backGestureEnabled_fullSwipe() =
        with(kosmos) {
            testScope.runTest {
                whenever(containerView.layoutDirection).thenReturn(View.LAYOUT_DIRECTION_LTR)
                goToScene(CommunalScenes.Communal)

                assertThat(containerView.systemGestureExclusionRects)
                    .containsExactly(
                        Rect(
                            /* left= */ 0,
                            /* top= */ 0,
                            /* right= */ FAKE_INSETS.right,
                            /* bottom= */ CONTAINER_HEIGHT
                        )
                    )
            }
        }

    @Test
    @EnableFlags(FLAG_GLANCEABLE_HUB_BACK_GESTURE)
    @DisableFlags(FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX)
    fun gestureExclusionZone_setAfterInit_backGestureEnabled_rtl() =
        with(kosmos) {
            testScope.runTest {
@@ -528,6 +592,28 @@ class GlanceableHubContainerControllerTest : SysuiTestCase() {
            }
        }

    @Test
    @EnableFlags(FLAG_GLANCEABLE_HUB_BACK_GESTURE, FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX)
    fun gestureExclusionZone_setAfterInit_backGestureEnabled_rtl_fullSwipe() =
        with(kosmos) {
            testScope.runTest {
                whenever(containerView.layoutDirection).thenReturn(View.LAYOUT_DIRECTION_RTL)
                goToScene(CommunalScenes.Communal)

                assertThat(containerView.systemGestureExclusionRects)
                    .containsExactly(
                        Rect(
                            Rect(
                                /* left= */ FAKE_INSETS.left,
                                /* top= */ 0,
                                /* right= */ CONTAINER_WIDTH,
                                /* bottom= */ CONTAINER_HEIGHT
                            )
                        )
                    )
            }
        }

    @Test
    fun gestureExclusionZone_unsetWhenShadeOpen() =
        with(kosmos) {