Add support for Tablets on split screen tests
Moreover, refactor the test to reuse the base test class with general assertions and fix ktlint errors Bug: 234735502 Test: atest WMShellFlickerTests Change-Id: I42404205b50483288c04933798d88680ad8f301b
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.wm.shell.flicker.splitscreen
|
||||
|
||||
import android.platform.test.annotations.Postsubmit
|
||||
import android.platform.test.annotations.Presubmit
|
||||
import android.view.WindowManagerPolicyConstants
|
||||
import androidx.test.filters.RequiresDevice
|
||||
@@ -57,7 +58,7 @@ class EnterSplitScreenByDragFromAllApps(
|
||||
|
||||
@Before
|
||||
fun before() {
|
||||
Assume.assumeTrue(taplInstrumentation.isTablet)
|
||||
Assume.assumeTrue(tapl.isTablet)
|
||||
}
|
||||
|
||||
override val transition: FlickerBuilder.() -> Unit
|
||||
@@ -65,12 +66,12 @@ class EnterSplitScreenByDragFromAllApps(
|
||||
super.transition(this)
|
||||
setup {
|
||||
eachRun {
|
||||
taplInstrumentation.goHome()
|
||||
tapl.goHome()
|
||||
primaryApp.launchViaIntent(wmHelper)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
taplInstrumentation.launchedAppState.taskbar
|
||||
tapl.launchedAppState.taskbar
|
||||
.openAllApps()
|
||||
.getAppIcon(secondaryApp.appName)
|
||||
.dragToSplitscreen(secondaryApp.`package`, primaryApp.`package`)
|
||||
@@ -108,6 +109,72 @@ class EnterSplitScreenByDragFromAllApps(
|
||||
fun secondaryAppWindowBecomesVisible() =
|
||||
testSpec.appWindowBecomesVisible(secondaryApp)
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun entireScreenCovered() =
|
||||
super.entireScreenCovered()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun navBarLayerIsVisibleAtStartAndEnd() =
|
||||
super.navBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun navBarLayerPositionAtStartAndEnd() =
|
||||
super.navBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun navBarWindowIsAlwaysVisible() =
|
||||
super.navBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun statusBarLayerIsVisibleAtStartAndEnd() =
|
||||
super.statusBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun statusBarLayerPositionAtStartAndEnd() =
|
||||
super.statusBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun statusBarWindowIsAlwaysVisible() =
|
||||
super.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() =
|
||||
super.taskBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun taskBarWindowIsAlwaysVisible() =
|
||||
super.taskBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun visibleLayersShownMoreThanOneConsecutiveEntry() =
|
||||
super.visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
|
||||
super.visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.wm.shell.flicker.splitscreen
|
||||
|
||||
import android.platform.test.annotations.Postsubmit
|
||||
import android.platform.test.annotations.Presubmit
|
||||
import android.view.WindowManagerPolicyConstants
|
||||
import androidx.test.filters.RequiresDevice
|
||||
@@ -60,9 +61,10 @@ class EnterSplitScreenByDragFromNotification(
|
||||
|
||||
@Before
|
||||
fun before() {
|
||||
Assume.assumeTrue(taplInstrumentation.isTablet)
|
||||
Assume.assumeTrue(tapl.isTablet)
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
override val transition: FlickerBuilder.() -> Unit
|
||||
get() = {
|
||||
super.transition(this)
|
||||
@@ -76,7 +78,7 @@ class EnterSplitScreenByDragFromNotification(
|
||||
)
|
||||
sendNotification?.click() ?: error("Send notification button not found")
|
||||
|
||||
taplInstrumentation.goHome()
|
||||
tapl.goHome()
|
||||
primaryApp.launchViaIntent(wmHelper)
|
||||
}
|
||||
}
|
||||
@@ -124,6 +126,72 @@ class EnterSplitScreenByDragFromNotification(
|
||||
fun secondaryAppWindowIsVisibleAtEnd() =
|
||||
testSpec.appWindowIsVisibleAtEnd(sendNotificationApp)
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun entireScreenCovered() =
|
||||
super.entireScreenCovered()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun navBarLayerIsVisibleAtStartAndEnd() =
|
||||
super.navBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun navBarLayerPositionAtStartAndEnd() =
|
||||
super.navBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun navBarWindowIsAlwaysVisible() =
|
||||
super.navBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun statusBarLayerIsVisibleAtStartAndEnd() =
|
||||
super.statusBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun statusBarLayerPositionAtStartAndEnd() =
|
||||
super.statusBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun statusBarWindowIsAlwaysVisible() =
|
||||
super.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() =
|
||||
super.taskBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun taskBarWindowIsAlwaysVisible() =
|
||||
super.taskBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun visibleLayersShownMoreThanOneConsecutiveEntry() =
|
||||
super.visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
|
||||
super.visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.wm.shell.flicker.splitscreen
|
||||
|
||||
import android.platform.test.annotations.Postsubmit
|
||||
import android.platform.test.annotations.Presubmit
|
||||
import android.view.WindowManagerPolicyConstants
|
||||
import androidx.test.filters.RequiresDevice
|
||||
@@ -57,23 +58,24 @@ class EnterSplitScreenByDragFromTaskbar(
|
||||
|
||||
@Before
|
||||
fun before() {
|
||||
Assume.assumeTrue(taplInstrumentation.isTablet)
|
||||
Assume.assumeTrue(tapl.isTablet)
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
override val transition: FlickerBuilder.() -> Unit
|
||||
get() = {
|
||||
super.transition(this)
|
||||
setup {
|
||||
eachRun {
|
||||
taplInstrumentation.goHome()
|
||||
tapl.goHome()
|
||||
SplitScreenHelper.createShortcutOnHotseatIfNotExist(
|
||||
taplInstrumentation, secondaryApp.appName
|
||||
tapl, secondaryApp.appName
|
||||
)
|
||||
primaryApp.launchViaIntent(wmHelper)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
taplInstrumentation.launchedAppState.taskbar
|
||||
tapl.launchedAppState.taskbar
|
||||
.getAppIcon(secondaryApp.appName)
|
||||
.dragToSplitscreen(
|
||||
secondaryApp.`package`,
|
||||
@@ -115,6 +117,72 @@ class EnterSplitScreenByDragFromTaskbar(
|
||||
fun secondaryAppWindowBecomesVisible() =
|
||||
testSpec.appWindowBecomesVisible(secondaryApp)
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun entireScreenCovered() =
|
||||
super.entireScreenCovered()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun navBarLayerIsVisibleAtStartAndEnd() =
|
||||
super.navBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun navBarLayerPositionAtStartAndEnd() =
|
||||
super.navBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun navBarWindowIsAlwaysVisible() =
|
||||
super.navBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun statusBarLayerIsVisibleAtStartAndEnd() =
|
||||
super.statusBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun statusBarLayerPositionAtStartAndEnd() =
|
||||
super.statusBarLayerPositionAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun statusBarWindowIsAlwaysVisible() =
|
||||
super.statusBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun taskBarLayerIsVisibleAtStartAndEnd() =
|
||||
super.taskBarLayerIsVisibleAtStartAndEnd()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun taskBarWindowIsAlwaysVisible() =
|
||||
super.taskBarWindowIsAlwaysVisible()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun visibleLayersShownMoreThanOneConsecutiveEntry() =
|
||||
super.visibleLayersShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Postsubmit
|
||||
@Test
|
||||
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
|
||||
super.visibleWindowsShownMoreThanOneConsecutiveEntry()
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
@JvmStatic
|
||||
|
||||
@@ -16,37 +16,26 @@
|
||||
|
||||
package com.android.wm.shell.flicker.splitscreen
|
||||
|
||||
import android.app.Instrumentation
|
||||
import android.content.Context
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.android.launcher3.tapl.LauncherInstrumentation
|
||||
import com.android.server.wm.flicker.FlickerBuilderProvider
|
||||
import com.android.server.wm.flicker.FlickerTestParameter
|
||||
import com.android.server.wm.flicker.dsl.FlickerBuilder
|
||||
import com.android.server.wm.flicker.helpers.setRotation
|
||||
import com.android.wm.shell.flicker.BaseTest
|
||||
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
|
||||
|
||||
abstract class SplitScreenBase(protected val testSpec: FlickerTestParameter) {
|
||||
protected val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
protected val taplInstrumentation = LauncherInstrumentation()
|
||||
abstract class SplitScreenBase(testSpec: FlickerTestParameter) : BaseTest(testSpec) {
|
||||
protected val context: Context = instrumentation.context
|
||||
protected val primaryApp = SplitScreenHelper.getPrimary(instrumentation)
|
||||
protected val secondaryApp = SplitScreenHelper.getSecondary(instrumentation)
|
||||
|
||||
@FlickerBuilderProvider
|
||||
fun buildFlicker(): FlickerBuilder {
|
||||
return FlickerBuilder(instrumentation).apply {
|
||||
transition(this)
|
||||
}
|
||||
}
|
||||
|
||||
protected open val transition: FlickerBuilder.() -> Unit
|
||||
/** {@inheritDoc} */
|
||||
override val transition: FlickerBuilder.() -> Unit
|
||||
get() = {
|
||||
setup {
|
||||
test {
|
||||
taplInstrumentation.setEnableRotation(true)
|
||||
tapl.setEnableRotation(true)
|
||||
setRotation(testSpec.startRotation)
|
||||
taplInstrumentation.setExpectedRotation(testSpec.startRotation)
|
||||
tapl.setExpectedRotation(testSpec.startRotation)
|
||||
}
|
||||
}
|
||||
teardown {
|
||||
|
||||
Reference in New Issue
Block a user