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