[go: nahoru, domu]

Fix Bottom Drawer test on Landspace devices

This CL fixes test that is failing on Nexus Player and all landscape
device due to different BottomDrawer open behaviour.

Bug: 136995518
Change-Id: Ie9e17d5611bf06e7e0e595f70d5f217a76d73db0
Test: :ui-material:connectedCheck
diff --git a/ui/material/src/androidTest/java/androidx/ui/material/DrawerTest.kt b/ui/material/src/androidTest/java/androidx/ui/material/DrawerTest.kt
index 25cadc9..fa3267c 100644
--- a/ui/material/src/androidTest/java/androidx/ui/material/DrawerTest.kt
+++ b/ui/material/src/androidTest/java/androidx/ui/material/DrawerTest.kt
@@ -103,8 +103,11 @@
                 }
             }
         }
+        val width = composeTestRule.displayMetrics.widthPixels
         val height = composeTestRule.displayMetrics.heightPixels
-        Truth.assertThat(position!!.y.round().value).isEqualTo((height / 2f).roundToInt())
+        // temporary calculation of landscape screen
+        val expectedHeight = if (width > height) height else (height / 2f).roundToInt()
+        Truth.assertThat(position!!.y.round().value).isEqualTo(expectedHeight)
     }
 
     @Test