diff --git a/sample/src/test/kotlin/com/google/android/horologist/screensizes/DialogTest.kt b/sample/src/test/kotlin/com/google/android/horologist/screensizes/DialogTest.kt index 512d7cef20..fbba882fe8 100644 --- a/sample/src/test/kotlin/com/google/android/horologist/screensizes/DialogTest.kt +++ b/sample/src/test/kotlin/com/google/android/horologist/screensizes/DialogTest.kt @@ -16,15 +16,25 @@ package com.google.android.horologist.screensizes +import android.R import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Check import androidx.compose.material.icons.filled.Close import androidx.compose.runtime.Composable +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextAlign +import androidx.wear.compose.material.MaterialTheme import androidx.wear.compose.material.Text import androidx.wear.compose.material.dialog.Alert +import com.google.android.horologist.compose.layout.ScalingLazyColumnState +import com.google.android.horologist.compose.layout.rememberColumnState import com.google.android.horologist.compose.material.AlertContent import com.google.android.horologist.compose.material.Button +import com.google.android.horologist.compose.material.ResponsiveDialogContent +import com.google.android.horologist.compose.material.ToggleChip +import com.google.android.horologist.compose.material.ToggleChipToggleControl import com.google.android.horologist.compose.tools.Device +import kotlinx.coroutines.runBlocking import org.junit.Test class DialogTest(device: Device) : ScreenSizeTest( @@ -70,4 +80,54 @@ class DialogTest(device: Device) : ScreenSizeTest( } } } + + @Test + fun longDialogScreen1() { + lateinit var columnState: ScalingLazyColumnState + + runTest(testFn = { + screenshotTestRule.interact { + runBlocking { + columnState.state.scrollToItem(999, 0) + } + } + + screenshotTestRule.takeScreenshot() + }) { + columnState = rememberColumnState() + + ResponsiveDialogContent( + title = { + Text( + text = "Turn on Bedtime mode?", + color = MaterialTheme.colors.onBackground, + textAlign = TextAlign.Center, + maxLines = 3, + ) + }, + onOkButtonClick = {}, + onCancelButtonClick = {}, + okButtonContentDescription = stringResource(R.string.ok), + cancelButtonContentDescription = stringResource(R.string.cancel), + state = columnState, + ) { + item { + Text( + text = "Watch screen, tilt-to-wake, and touch are turned off. " + + "Only calls from starred contacts, repeat callers, " + + "and alarms will notify you.", + textAlign = TextAlign.Left, + ) + } + item { + ToggleChip( + checked = false, + onCheckedChanged = {}, + label = "Don't show again", + toggleControl = ToggleChipToggleControl.Checkbox, + ) + } + } + } + } } diff --git a/sample/src/test/kotlin/com/google/android/horologist/screensizes/ScreenSizeTest.kt b/sample/src/test/kotlin/com/google/android/horologist/screensizes/ScreenSizeTest.kt index 60657b799c..7eba135067 100644 --- a/sample/src/test/kotlin/com/google/android/horologist/screensizes/ScreenSizeTest.kt +++ b/sample/src/test/kotlin/com/google/android/horologist/screensizes/ScreenSizeTest.kt @@ -63,7 +63,7 @@ abstract class ScreenSizeTest( runTest { Content() } } - fun runTest(content: @Composable () -> Unit) { + fun runTest(testFn: () -> Unit = {}, content: @Composable () -> Unit) { val shadowDisplay = Shadows.shadowOf(ShadowDisplay.getDefaultDisplay()) shadowDisplay.setDensity(device.density) shadowDisplay.setHeight(device.screenSizePx) @@ -82,6 +82,8 @@ abstract class ScreenSizeTest( content = content, ) } + + testFn() } companion object { diff --git a/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[0]_mobvoiticwatchpro5.png b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[0]_mobvoiticwatchpro5.png new file mode 100644 index 0000000000..6f4c462f6e --- /dev/null +++ b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[0]_mobvoiticwatchpro5.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e667301e3a13f55f631ebcf44878a63904b82d592fa16b7264891014fbf2b0e2 +size 45867 diff --git a/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[0]_mobvoiticwatchpro5_2.png b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[0]_mobvoiticwatchpro5_2.png new file mode 100644 index 0000000000..aaa1aa69c9 --- /dev/null +++ b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[0]_mobvoiticwatchpro5_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0ec894bcf66251f0d76c59530547e26d7f984df5d4c33145e2a29cd7c753378 +size 36676 diff --git a/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[1]_samsunggalaxywatch5.png b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[1]_samsunggalaxywatch5.png new file mode 100644 index 0000000000..37c612544e --- /dev/null +++ b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[1]_samsunggalaxywatch5.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:31955eb9de24445d77a4ed4d0c34a858021e816e577699b6439717e403c40661 +size 37885 diff --git a/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[1]_samsunggalaxywatch5_2.png b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[1]_samsunggalaxywatch5_2.png new file mode 100644 index 0000000000..7b25395085 --- /dev/null +++ b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[1]_samsunggalaxywatch5_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:149d58154688141c1f6e9efce7355d549de6917935dc4bd5fe2efec747102456 +size 29900 diff --git a/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[2]_samsunggalaxywatch6large.png b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[2]_samsunggalaxywatch6large.png new file mode 100644 index 0000000000..9018541677 --- /dev/null +++ b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[2]_samsunggalaxywatch6large.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:16494a40f8da3bbbd2f467f2325bef2ba88757cbc68784ec237e56ad36856cf6 +size 47280 diff --git a/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[2]_samsunggalaxywatch6large_2.png b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[2]_samsunggalaxywatch6large_2.png new file mode 100644 index 0000000000..8751bf0b52 --- /dev/null +++ b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[2]_samsunggalaxywatch6large_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb47f191195885b6d10ed4f8c7bee3b01dd371ea959a5a55e61cde0ddf1c1b9c +size 37796 diff --git a/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[3]_googlepixelwatch.png b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[3]_googlepixelwatch.png new file mode 100644 index 0000000000..954401ce7b --- /dev/null +++ b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[3]_googlepixelwatch.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9dc3c851fff78ca46b3d9a2481d27e857123d963d172315dd709077be4d9bb68 +size 37899 diff --git a/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[3]_googlepixelwatch_2.png b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[3]_googlepixelwatch_2.png new file mode 100644 index 0000000000..8f88eb4b64 --- /dev/null +++ b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[3]_googlepixelwatch_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf81d6120bb949ed0e913f34949ee52cde061c51550756fb8dd975784bb6b816 +size 28665 diff --git a/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[4]_genericsmallround.png b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[4]_genericsmallround.png new file mode 100644 index 0000000000..954401ce7b --- /dev/null +++ b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[4]_genericsmallround.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9dc3c851fff78ca46b3d9a2481d27e857123d963d172315dd709077be4d9bb68 +size 37899 diff --git a/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[4]_genericsmallround_2.png b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[4]_genericsmallround_2.png new file mode 100644 index 0000000000..8f88eb4b64 --- /dev/null +++ b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[4]_genericsmallround_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf81d6120bb949ed0e913f34949ee52cde061c51550756fb8dd975784bb6b816 +size 28665 diff --git a/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[5]_genericlargeround.png b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[5]_genericlargeround.png new file mode 100644 index 0000000000..76cabeb9fe --- /dev/null +++ b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[5]_genericlargeround.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:52c3f72a0d30660084c879a75b802d2a13247643b814c9a21905e1ac05b58e96 +size 44492 diff --git a/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[5]_genericlargeround_2.png b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[5]_genericlargeround_2.png new file mode 100644 index 0000000000..8a9ecc61f9 --- /dev/null +++ b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[5]_genericlargeround_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:749f954073efef3ab040e949f93a743497674c91cb22d599cb1ac49d4db2c025 +size 35519 diff --git a/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[6]_smalldevicebigfonts.png b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[6]_smalldevicebigfonts.png new file mode 100644 index 0000000000..75b69bd2a1 --- /dev/null +++ b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[6]_smalldevicebigfonts.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:419c50033584a2cb21f7b0295ec2beb0759dc1d208458206deec2772c7b915bd +size 31589 diff --git a/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[6]_smalldevicebigfonts_2.png b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[6]_smalldevicebigfonts_2.png new file mode 100644 index 0000000000..e045477e86 --- /dev/null +++ b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[6]_smalldevicebigfonts_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9f691321327dd17abab12557345fb2613d47d0a42b2d2b634456efa667b6cf3d +size 24820 diff --git a/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[7]_largedevicesmallfonts.png b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[7]_largedevicesmallfonts.png new file mode 100644 index 0000000000..940576dbc7 --- /dev/null +++ b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[7]_largedevicesmallfonts.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:36d89f74be48c0fceb2a1e30924440bea3665e6e7dd35d00584f04074d7c59ff +size 45824 diff --git a/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[7]_largedevicesmallfonts_2.png b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[7]_largedevicesmallfonts_2.png new file mode 100644 index 0000000000..66ec63672e --- /dev/null +++ b/sample/src/test/snapshots/images/com.google.android.horologist.screensizes_DialogTest_longDialogScreen1[7]_largedevicesmallfonts_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c8e15b33e57417abd00b4d0bea4ac8e2626268da9de5e49724dfff92c852631 +size 40255