Skip to content

Commit

Permalink
Merge pull request #1011 from android/compose-starter-screenshots
Browse files Browse the repository at this point in the history
Adds font scaling screenshot tests
  • Loading branch information
garanj authored Feb 28, 2024
2 parents 725689c + ed98439 commit 017b88d
Show file tree
Hide file tree
Showing 18 changed files with 19 additions and 2 deletions.
19 changes: 17 additions & 2 deletions ComposeStarter/app/src/test/java/presentation/WearDevice.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ enum class WearDevice(
val id: String,
val modelName: String,
val screenSizePx: Int,
val density: Float
val density: Float,
val fontScale: Float = 1f
) {
MobvoiTicWatchPro5(
id = "ticwatch_pro_5",
Expand All @@ -35,7 +36,7 @@ enum class WearDevice(
screenSizePx = 396,
density = 2.0f
),
SamsungGalaxyWatch6Large(
SamsungGalaxyWatch6(
id = "galaxy_watch_6",
modelName = "Samsung Galaxy Watch 6 Large",
screenSizePx = 480,
Expand All @@ -58,6 +59,20 @@ enum class WearDevice(
modelName = "Generic Large Round",
screenSizePx = 454,
density = 2.0f
),
SamsungGalaxyWatch6SmallFont(
id = "galaxy_watch_6_small_font",
modelName = "Samsung Galaxy Watch 6 Large",
screenSizePx = 480,
density = 2.125f,
fontScale = 0.94f
),
GooglePixelWatchLargeFont(
id = "pixel_watch_large_font",
modelName = "Google Pixel Watch",
screenSizePx = 384,
density = 2.0f,
fontScale = 1.24f
);

val dp: Int = (screenSizePx / density).roundToInt()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ abstract class WearScreenshotTest {
@OptIn(ExperimentalRoborazziApi::class)
fun runTest(content: @Composable () -> Unit) {
RuntimeEnvironment.setQualifiers("+w${device.dp}dp-h${device.dp}dp")
RuntimeEnvironment.setFontScale(device.fontScale)

composeRule.setContent {
content()
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 017b88d

Please sign in to comment.