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

Commit fa4a167f authored by Ang Li's avatar Ang Li Committed by Android (Google) Code Review
Browse files

Merge "Add test for multi-display cutout handling in SysUICutoutProvider" into main

parents 341fbacf 15c84c9f
Loading
Loading
Loading
Loading
+25 −0
Original line number Original line Diff line number Diff line
@@ -49,6 +49,31 @@ class SysUICutoutProviderTest : SysuiTestCase() {
        assertThat(sysUICutout).isNull()
        assertThat(sysUICutout).isNull()
    }
    }


    @Test
    fun cutoutInfo_dependsOnInjectedDisplayContext() {
        // This test verifies that the provider's output depends on the display from the
        // injected context. This is critical for multi-display scenarios, where different
        // displays can have different cutout properties.

        // GIVEN a provider for an external display with NO cutout
        val externalDisplay = createDisplay(uniqueId = "external", cutout = null)
        val externalContext = context.createDisplayContext(externalDisplay)
        val externalProvider = SysUICutoutProviderImpl(externalContext, fakeProtectionLoader)

        // THEN it returns no cutout info
        assertThat(externalProvider.cutoutInfoForCurrentDisplayAndRotation()).isNull()

        // GIVEN a provider for an internal display WITH a cutout
        val internalDisplay = createDisplay(uniqueId = "internal", cutout = mock())
        val internalContext = context.createDisplayContext(internalDisplay)
        val internalProvider = SysUICutoutProviderImpl(internalContext, fakeProtectionLoader)

        // THEN it returns the correct cutout info
        val internalCutoutInfo = internalProvider.cutoutInfoForCurrentDisplayAndRotation()
        assertThat(internalCutoutInfo).isNotNull()
        assertThat(internalCutoutInfo!!.cutout).isEqualTo(internalDisplay.cutout)
    }

    @Test
    @Test
    fun cutoutInfoForCurrentDisplay_returnsCutout() {
    fun cutoutInfoForCurrentDisplay_returnsCutout() {
        val cutoutDisplay = createDisplay()
        val cutoutDisplay = createDisplay()