diff --git a/app/src/androidTest/java/com/google/samples/apps/nowinandroid/ui/NavigationUiTest.kt b/app/src/androidTest/java/com/google/samples/apps/nowinandroid/ui/NavigationUiTest.kt index b52aa2aba..26502e820 100644 --- a/app/src/androidTest/java/com/google/samples/apps/nowinandroid/ui/NavigationUiTest.kt +++ b/app/src/androidTest/java/com/google/samples/apps/nowinandroid/ui/NavigationUiTest.kt @@ -149,6 +149,27 @@ class NavigationUiTest { composeTestRule.onNodeWithTag("adaptiveScaffold:permanentDrawer").assertDoesNotExist() } + @Test + fun extraLargeWidth_compactHeight_showsPermanentDrawer() { + composeTestRule.setContent { + TestHarness(size = DpSize(1300.dp, 400.dp)) { + BoxWithConstraints { + NiaApp( + windowSizeClass = WindowSizeClass.calculateFromSize( + DpSize(maxWidth, maxHeight), + ), + networkMonitor = networkMonitor, + userNewsResourceRepository = userNewsResourceRepository, + ) + } + } + } + + composeTestRule.onNodeWithTag("adaptiveScaffold:navigationRail").assertDoesNotExist() + composeTestRule.onNodeWithTag("adaptiveScaffold:navigationBar").assertDoesNotExist() + composeTestRule.onNodeWithTag("adaptiveScaffold:permanentDrawer").assertIsDisplayed() + } + @Test fun compactWidth_mediumHeight_showsNavigationBar() { composeTestRule.setContent { @@ -212,6 +233,27 @@ class NavigationUiTest { composeTestRule.onNodeWithTag("adaptiveScaffold:permanentDrawer").assertDoesNotExist() } + @Test + fun extraLargeWidth_mediumHeight_showsPermanentDrawer() { + composeTestRule.setContent { + TestHarness(size = DpSize(1300.dp, 500.dp)) { + BoxWithConstraints { + NiaApp( + windowSizeClass = WindowSizeClass.calculateFromSize( + DpSize(maxWidth, maxHeight), + ), + networkMonitor = networkMonitor, + userNewsResourceRepository = userNewsResourceRepository, + ) + } + } + } + + composeTestRule.onNodeWithTag("adaptiveScaffold:navigationRail").assertDoesNotExist() + composeTestRule.onNodeWithTag("adaptiveScaffold:navigationBar").assertDoesNotExist() + composeTestRule.onNodeWithTag("adaptiveScaffold:permanentDrawer").assertIsDisplayed() + } + @Test fun compactWidth_expandedHeight_showsNavigationBar() { composeTestRule.setContent { @@ -274,4 +316,25 @@ class NavigationUiTest { composeTestRule.onNodeWithTag("adaptiveScaffold:navigationBar").assertDoesNotExist() composeTestRule.onNodeWithTag("adaptiveScaffold:permanentDrawer").assertDoesNotExist() } + + @Test + fun extraLargeWidth_expandedHeight_showsPermanentDrawer() { + composeTestRule.setContent { + TestHarness(size = DpSize(1300.dp, 900.dp)) { + BoxWithConstraints { + NiaApp( + windowSizeClass = WindowSizeClass.calculateFromSize( + DpSize(maxWidth, maxHeight), + ), + networkMonitor = networkMonitor, + userNewsResourceRepository = userNewsResourceRepository, + ) + } + } + } + + composeTestRule.onNodeWithTag("adaptiveScaffold:navigationRail").assertDoesNotExist() + composeTestRule.onNodeWithTag("adaptiveScaffold:navigationBar").assertDoesNotExist() + composeTestRule.onNodeWithTag("adaptiveScaffold:permanentDrawer").assertIsDisplayed() + } }