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

Commit 31b85dda authored by Chilun Huang's avatar Chilun Huang
Browse files

Modify app expected position base on the drag behavior change

Because ag/18529596 change the drop position, the test need to modify
the expected position of the app.

Bug: 232878493
Test: atest EnterSplitScreenByDragFromAllApps
Change-Id: Ib4823a899aa42ab2c0b23f9e654cbf13becb02bd
parent c46e9f69
Loading
Loading
Loading
Loading
+14 −30
Original line number Diff line number Diff line
@@ -24,15 +24,14 @@ 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.layerBecomesVisible
import com.android.wm.shell.flicker.layerIsVisibleAtEnd
import com.android.wm.shell.flicker.splitAppLayerBoundsBecomesVisible
import com.android.wm.shell.flicker.splitAppLayerBoundsIsVisibleAtEnd
import com.android.wm.shell.flicker.splitScreenDividerBecomesVisible
import org.junit.Assume
import org.junit.Before
import org.junit.FixMethodOrder
@@ -76,11 +75,6 @@ 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")
            }
        }

@@ -99,12 +93,12 @@ class EnterSplitScreenByDragFromAllApps(
    @Presubmit
    @Test
    fun primaryAppBoundsIsVisibleAtEnd() = testSpec.splitAppLayerBoundsIsVisibleAtEnd(
            testSpec.endRotation, primaryApp.component, isAppLeftTop(true))
        testSpec.endRotation, primaryApp.component, false /* splitLeftTop */)

    @Presubmit
    @Test
    fun secondaryAppBoundsBecomesVisible() = testSpec.splitAppLayerBoundsBecomesVisible(
            testSpec.endRotation, secondaryApp.component, isAppLeftTop(false))
        testSpec.endRotation, secondaryApp.component, true /* splitLeftTop */)

    @Presubmit
    @Test
@@ -115,14 +109,6 @@ 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
@@ -133,7 +119,5 @@ class EnterSplitScreenByDragFromAllApps(
                supportedNavigationModes =
                    listOf(WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY))
        }

        private lateinit var endDisplayBounds: Rect
    }
}