diff --git a/core/designsystem/src/test/java/com/wei/amazingtalker/core/designsystem/NavigationScreenshotTests.kt b/core/designsystem/src/test/java/com/wei/amazingtalker/core/designsystem/NavigationScreenshotTests.kt index f8bd1245..e6b69ed0 100644 --- a/core/designsystem/src/test/java/com/wei/amazingtalker/core/designsystem/NavigationScreenshotTests.kt +++ b/core/designsystem/src/test/java/com/wei/amazingtalker/core/designsystem/NavigationScreenshotTests.kt @@ -13,6 +13,10 @@ import com.github.takahirom.roborazzi.captureRoboImage import com.google.accompanist.testharness.TestHarness import com.wei.amazingtalker.core.designsystem.component.AtNavigationBar import com.wei.amazingtalker.core.designsystem.component.AtNavigationBarItem +import com.wei.amazingtalker.core.designsystem.component.AtNavigationDrawer +import com.wei.amazingtalker.core.designsystem.component.AtNavigationDrawerItem +import com.wei.amazingtalker.core.designsystem.component.AtNavigationRail +import com.wei.amazingtalker.core.designsystem.component.AtNavigationRailItem import com.wei.amazingtalker.core.designsystem.icon.AtIcons import com.wei.amazingtalker.core.designsystem.theme.AtTheme import com.wei.amazingtalker.core.testing.util.DefaultRoborazziOptions @@ -36,8 +40,8 @@ class NavigationScreenshotTests() { val composeTestRule = createAndroidComposeRule() @Test - fun navigation_multipleThemes() { - composeTestRule.captureMultiTheme("Navigation") { + fun navigationBar_multipleThemes() { + composeTestRule.captureMultiTheme("NavigationBar") { Surface { AtNavigationBarExample() } @@ -45,7 +49,7 @@ class NavigationScreenshotTests() { } @Test - fun navigation_hugeFont() { + fun navigationBar_hugeFont() { composeTestRule.setContent { CompositionLocalProvider( LocalInspectionMode provides true, @@ -59,8 +63,47 @@ class NavigationScreenshotTests() { } composeTestRule.onRoot() .captureRoboImage( - "src/test/screenshots/Navigation" + - "/Navigation_fontScale2.png", + "src/test/screenshots/NavigationBar" + + "/NavigationBar_fontScale2.png", + roborazziOptions = DefaultRoborazziOptions, + ) + } + + @Test + fun navigationRail_multipleThemes() { + composeTestRule.captureMultiTheme("NavigationRail") { + Surface { + AtNavigationRailExample() + } + } + } + + @Test + fun navigationDrawer_multipleThemes() { + composeTestRule.captureMultiTheme("NavigationDrawer") { + Surface { + AtNavigationDrawerExample() + } + } + } + + @Test + fun navigationDrawer_hugeFont() { + composeTestRule.setContent { + CompositionLocalProvider( + LocalInspectionMode provides true, + ) { + TestHarness(fontScale = 2f) { + AtTheme { + AtNavigationDrawerExample("Loooooooooooooooong item") + } + } + } + } + composeTestRule.onRoot() + .captureRoboImage( + "src/test/screenshots/NavigationDrawer" + + "/NavigationDrawer_fontScale2.png", roborazziOptions = DefaultRoborazziOptions, ) } @@ -89,4 +132,53 @@ class NavigationScreenshotTests() { } } } + + @Composable + private fun AtNavigationRailExample() { + AtNavigationRail { + (0..2).forEach { index -> + AtNavigationRailItem( + selected = index == 0, + onClick = { }, + icon = { + Icon( + imageVector = AtIcons.UpcomingBorder, + contentDescription = "", + ) + }, + selectedIcon = { + Icon( + imageVector = AtIcons.Upcoming, + contentDescription = "", + ) + }, + ) + } + } + } + + @Composable + private fun AtNavigationDrawerExample(label: String = "Item") { + AtNavigationDrawer { + (0..2).forEach { index -> + AtNavigationDrawerItem( + selected = index == 0, + onClick = { }, + icon = { + Icon( + imageVector = AtIcons.UpcomingBorder, + contentDescription = "", + ) + }, + selectedIcon = { + Icon( + imageVector = AtIcons.Upcoming, + contentDescription = "", + ) + }, + label = { Text(label) }, + ) + } + } + } } diff --git a/core/designsystem/src/test/screenshots/Navigation/Navigation_dark_androidTheme.png b/core/designsystem/src/test/screenshots/NavigationBar/NavigationBar_dark_androidTheme.png similarity index 100% rename from core/designsystem/src/test/screenshots/Navigation/Navigation_dark_androidTheme.png rename to core/designsystem/src/test/screenshots/NavigationBar/NavigationBar_dark_androidTheme.png diff --git a/core/designsystem/src/test/screenshots/Navigation/Navigation_dark_defaultTheme.png b/core/designsystem/src/test/screenshots/NavigationBar/NavigationBar_dark_defaultTheme.png similarity index 100% rename from core/designsystem/src/test/screenshots/Navigation/Navigation_dark_defaultTheme.png rename to core/designsystem/src/test/screenshots/NavigationBar/NavigationBar_dark_defaultTheme.png diff --git a/core/designsystem/src/test/screenshots/Navigation/Navigation_fontScale2.png b/core/designsystem/src/test/screenshots/NavigationBar/NavigationBar_fontScale2.png similarity index 100% rename from core/designsystem/src/test/screenshots/Navigation/Navigation_fontScale2.png rename to core/designsystem/src/test/screenshots/NavigationBar/NavigationBar_fontScale2.png diff --git a/core/designsystem/src/test/screenshots/Navigation/Navigation_light_androidTheme.png b/core/designsystem/src/test/screenshots/NavigationBar/NavigationBar_light_androidTheme.png similarity index 100% rename from core/designsystem/src/test/screenshots/Navigation/Navigation_light_androidTheme.png rename to core/designsystem/src/test/screenshots/NavigationBar/NavigationBar_light_androidTheme.png diff --git a/core/designsystem/src/test/screenshots/Navigation/Navigation_light_defaultTheme.png b/core/designsystem/src/test/screenshots/NavigationBar/NavigationBar_light_defaultTheme.png similarity index 100% rename from core/designsystem/src/test/screenshots/Navigation/Navigation_light_defaultTheme.png rename to core/designsystem/src/test/screenshots/NavigationBar/NavigationBar_light_defaultTheme.png diff --git a/core/designsystem/src/test/screenshots/NavigationDrawer/NavigationDrawer_dark_androidTheme.png b/core/designsystem/src/test/screenshots/NavigationDrawer/NavigationDrawer_dark_androidTheme.png new file mode 100644 index 00000000..06fee765 Binary files /dev/null and b/core/designsystem/src/test/screenshots/NavigationDrawer/NavigationDrawer_dark_androidTheme.png differ diff --git a/core/designsystem/src/test/screenshots/NavigationDrawer/NavigationDrawer_dark_defaultTheme.png b/core/designsystem/src/test/screenshots/NavigationDrawer/NavigationDrawer_dark_defaultTheme.png new file mode 100644 index 00000000..06fee765 Binary files /dev/null and b/core/designsystem/src/test/screenshots/NavigationDrawer/NavigationDrawer_dark_defaultTheme.png differ diff --git a/core/designsystem/src/test/screenshots/NavigationDrawer/NavigationDrawer_fontScale2.png b/core/designsystem/src/test/screenshots/NavigationDrawer/NavigationDrawer_fontScale2.png new file mode 100644 index 00000000..67f5a713 Binary files /dev/null and b/core/designsystem/src/test/screenshots/NavigationDrawer/NavigationDrawer_fontScale2.png differ diff --git a/core/designsystem/src/test/screenshots/NavigationDrawer/NavigationDrawer_light_androidTheme.png b/core/designsystem/src/test/screenshots/NavigationDrawer/NavigationDrawer_light_androidTheme.png new file mode 100644 index 00000000..a4459ff9 Binary files /dev/null and b/core/designsystem/src/test/screenshots/NavigationDrawer/NavigationDrawer_light_androidTheme.png differ diff --git a/core/designsystem/src/test/screenshots/NavigationDrawer/NavigationDrawer_light_defaultTheme.png b/core/designsystem/src/test/screenshots/NavigationDrawer/NavigationDrawer_light_defaultTheme.png new file mode 100644 index 00000000..a4459ff9 Binary files /dev/null and b/core/designsystem/src/test/screenshots/NavigationDrawer/NavigationDrawer_light_defaultTheme.png differ diff --git a/core/designsystem/src/test/screenshots/NavigationRail/NavigationRail_dark_androidTheme.png b/core/designsystem/src/test/screenshots/NavigationRail/NavigationRail_dark_androidTheme.png new file mode 100644 index 00000000..62dd6015 Binary files /dev/null and b/core/designsystem/src/test/screenshots/NavigationRail/NavigationRail_dark_androidTheme.png differ diff --git a/core/designsystem/src/test/screenshots/NavigationRail/NavigationRail_dark_defaultTheme.png b/core/designsystem/src/test/screenshots/NavigationRail/NavigationRail_dark_defaultTheme.png new file mode 100644 index 00000000..62dd6015 Binary files /dev/null and b/core/designsystem/src/test/screenshots/NavigationRail/NavigationRail_dark_defaultTheme.png differ diff --git a/core/designsystem/src/test/screenshots/NavigationRail/NavigationRail_light_androidTheme.png b/core/designsystem/src/test/screenshots/NavigationRail/NavigationRail_light_androidTheme.png new file mode 100644 index 00000000..d90e260b Binary files /dev/null and b/core/designsystem/src/test/screenshots/NavigationRail/NavigationRail_light_androidTheme.png differ diff --git a/core/designsystem/src/test/screenshots/NavigationRail/NavigationRail_light_defaultTheme.png b/core/designsystem/src/test/screenshots/NavigationRail/NavigationRail_light_defaultTheme.png new file mode 100644 index 00000000..d90e260b Binary files /dev/null and b/core/designsystem/src/test/screenshots/NavigationRail/NavigationRail_light_defaultTheme.png differ