|
|
|
@ -80,70 +80,71 @@ class EdgeToEdgeTest {
|
|
|
|
|
@get:Rule(order = 3)
|
|
|
|
|
val activityScenarioRule = ActivityScenarioRule(MainActivity::class.java)
|
|
|
|
|
|
|
|
|
|
@get:Rule(order = 4)
|
|
|
|
|
val dropshots = Dropshots()
|
|
|
|
|
// @get:Rule(order = 4)
|
|
|
|
|
// val dropshots = Dropshots()
|
|
|
|
|
|
|
|
|
|
@Before
|
|
|
|
|
fun setup() = hiltRule.inject()
|
|
|
|
|
|
|
|
|
|
@Before
|
|
|
|
|
fun enableDemoMode() {
|
|
|
|
|
UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()).apply {
|
|
|
|
|
executeShellCommand("settings put global sysui_demo_allowed 1")
|
|
|
|
|
executeShellCommand(
|
|
|
|
|
"am broadcast -a com.android.systemui.demo -e command " +
|
|
|
|
|
"enter",
|
|
|
|
|
)
|
|
|
|
|
executeShellCommand(
|
|
|
|
|
"am broadcast -a com.android.systemui.demo -e command " +
|
|
|
|
|
"notifications -e visible false",
|
|
|
|
|
)
|
|
|
|
|
executeShellCommand(
|
|
|
|
|
"am broadcast -a com.android.systemui.demo -e command " +
|
|
|
|
|
"clock -e hhmm 1234",
|
|
|
|
|
)
|
|
|
|
|
executeShellCommand(
|
|
|
|
|
"am broadcast -a com.android.systemui.demo -e command " +
|
|
|
|
|
"network -e wifi hide",
|
|
|
|
|
)
|
|
|
|
|
executeShellCommand(
|
|
|
|
|
"am broadcast -a com.android.systemui.demo -e command " +
|
|
|
|
|
"network -e mobile hide",
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
|
@JvmStatic
|
|
|
|
|
@AfterClass
|
|
|
|
|
fun resetDemoMode() {
|
|
|
|
|
executeShellCommand("am broadcast -a com.android.systemui.demo -e command exit")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequiresDisplay(WidthSizeClassEnum.COMPACT, HeightSizeClassEnum.MEDIUM)
|
|
|
|
|
@SdkSuppress(minSdkVersion = 27, maxSdkVersion = 27)
|
|
|
|
|
@Test
|
|
|
|
|
fun edgeToEdge_Phone_Api27() {
|
|
|
|
|
screenshotSystemBar("edgeToEdge_Phone_systemBar_Api27")
|
|
|
|
|
screenshotNavigationBar("edgeToEdge_Phone_navBar_Api27")
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
// @Before
|
|
|
|
|
// fun enableDemoMode() {
|
|
|
|
|
// UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()).apply {
|
|
|
|
|
// executeShellCommand("settings put global sysui_demo_allowed 1")
|
|
|
|
|
// executeShellCommand(
|
|
|
|
|
// "am broadcast -a com.android.systemui.demo -e command " +
|
|
|
|
|
// "enter",
|
|
|
|
|
// )
|
|
|
|
|
// executeShellCommand(
|
|
|
|
|
// "am broadcast -a com.android.systemui.demo -e command " +
|
|
|
|
|
// "notifications -e visible false",
|
|
|
|
|
// )
|
|
|
|
|
// executeShellCommand(
|
|
|
|
|
// "am broadcast -a com.android.systemui.demo -e command " +
|
|
|
|
|
// "clock -e hhmm 1234",
|
|
|
|
|
// )
|
|
|
|
|
// executeShellCommand(
|
|
|
|
|
// "am broadcast -a com.android.systemui.demo -e command " +
|
|
|
|
|
// "network -e wifi hide",
|
|
|
|
|
// )
|
|
|
|
|
// executeShellCommand(
|
|
|
|
|
// "am broadcast -a com.android.systemui.demo -e command " +
|
|
|
|
|
// "network -e mobile hide",
|
|
|
|
|
// )
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// companion object {
|
|
|
|
|
// @JvmStatic
|
|
|
|
|
// @AfterClass
|
|
|
|
|
// fun resetDemoMode() {
|
|
|
|
|
// executeShellCommand("am broadcast -a com.android.systemui.demo -e command exit")
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// @RequiresDisplay(WidthSizeClassEnum.COMPACT, HeightSizeClassEnum.MEDIUM)
|
|
|
|
|
// @SdkSuppress(minSdkVersion = 27, maxSdkVersion = 27)
|
|
|
|
|
// @Test
|
|
|
|
|
// fun edgeToEdge_Phone_Api27() {
|
|
|
|
|
// screenshotSystemBar("edgeToEdge_Phone_systemBar_Api27")
|
|
|
|
|
// screenshotNavigationBar("edgeToEdge_Phone_navBar_Api27")
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
@RequiresDeviceMode(mode = FLAT)
|
|
|
|
|
@RequiresDeviceMode(mode = CLOSED)
|
|
|
|
|
@SdkSuppress(minSdkVersion = 33, maxSdkVersion = 33)
|
|
|
|
|
@Test
|
|
|
|
|
fun edgeToEdge_Foldable_api33() {
|
|
|
|
|
runFoldableTests(apiName = "api33")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequiresDeviceMode(mode = FLAT)
|
|
|
|
|
@RequiresDeviceMode(mode = CLOSED)
|
|
|
|
|
@SdkSuppress(minSdkVersion = 35, codeName = "VanillaIceCream")
|
|
|
|
|
@Test
|
|
|
|
|
fun edgeToEdge_Foldable_api35() {
|
|
|
|
|
runFoldableTests(apiName = "api35")
|
|
|
|
|
assert(true)
|
|
|
|
|
//runFoldableTests(apiName = "api33")
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
// @RequiresDeviceMode(mode = FLAT)
|
|
|
|
|
// @RequiresDeviceMode(mode = CLOSED)
|
|
|
|
|
// @SdkSuppress(minSdkVersion = 35, codeName = "VanillaIceCream")
|
|
|
|
|
// @Test
|
|
|
|
|
// fun edgeToEdge_Foldable_api35() {
|
|
|
|
|
// runFoldableTests(apiName = "api35")
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// Very flaky:DeviceControllerOperationException: Device could not be set to the
|
|
|
|
|
// requested screen orientation.
|
|
|
|
@ -167,7 +168,7 @@ class EdgeToEdgeTest {
|
|
|
|
|
screenshotNavigationBar("edgeToEdge_Foldable_closed_navGesture_$apiName")
|
|
|
|
|
|
|
|
|
|
//onDevice().setFlatMode()
|
|
|
|
|
enableDemoMode() // Flat mode resets demo mode!
|
|
|
|
|
//enableDemoMode() // Flat mode resets demo mode!
|
|
|
|
|
screenshotSystemBar("edgeToEdge_Foldable_flat_system_$apiName")
|
|
|
|
|
forceThreeButtonNavigation()
|
|
|
|
|
screenshotNavigationBar("edgeToEdge_Foldable_flat_nav3button_$apiName")
|
|
|
|
@ -236,22 +237,22 @@ class EdgeToEdgeTest {
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun assertSnapshot(
|
|
|
|
|
bitmap: Bitmap,
|
|
|
|
|
name: String,
|
|
|
|
|
filePath: String? = null,
|
|
|
|
|
) {
|
|
|
|
|
// Try to assert 3 times
|
|
|
|
|
var count = 2
|
|
|
|
|
while (true) {
|
|
|
|
|
try {
|
|
|
|
|
dropshots.assertSnapshot(bitmap, name, filePath)
|
|
|
|
|
} catch (e: AssertionError) {
|
|
|
|
|
if (count == 0) throw e
|
|
|
|
|
count -= 1
|
|
|
|
|
Log.i("EdgeToEdgeTest", "Test failed, retrying (count=$count)")
|
|
|
|
|
waitForWindowUpdate()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// fun assertSnapshot(
|
|
|
|
|
// bitmap: Bitmap,
|
|
|
|
|
// name: String,
|
|
|
|
|
// filePath: String? = null,
|
|
|
|
|
// ) {
|
|
|
|
|
// // Try to assert 3 times
|
|
|
|
|
// var count = 2
|
|
|
|
|
// while (true) {
|
|
|
|
|
// try {
|
|
|
|
|
// dropshots.assertSnapshot(bitmap, name, filePath)
|
|
|
|
|
// } catch (e: AssertionError) {
|
|
|
|
|
// if (count == 0) throw e
|
|
|
|
|
// count -= 1
|
|
|
|
|
// Log.i("EdgeToEdgeTest", "Test failed, retrying (count=$count)")
|
|
|
|
|
// waitForWindowUpdate()
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|