diff --git a/appwidget-testing/README.md b/appwidget-testing/README.md index 5bfd65f..2045bf8 100644 --- a/appwidget-testing/README.md +++ b/appwidget-testing/README.md @@ -47,6 +47,11 @@ Then, using screenshot testing tool of your choice capture and compare the scree activity. For example, following sample uses [Roborazzi](https://github.com/takahirom/roborazzi) capture and verify the screenshot. +NOTE: The device and screenshot framework you use should support hardware acceleration and +`clipToOutline` to see rounded corners. For robolectric, see this +[issue](https://github.com/robolectric/robolectric/issues/8081#issuecomment-1478137890). When using +an emulator, you may use Espresso's `captureToBitmap` to ensure that the corner radius is captured. + ```kotlin Espresso.onView(ViewMatchers.isRoot()) .captureRoboImage( diff --git a/appwidget-testing/src/main/java/com/google/android/glance/appwidget/testing/GlanceScreenshotTestActivity.kt b/appwidget-testing/src/main/java/com/google/android/glance/appwidget/testing/GlanceScreenshotTestActivity.kt index 7d33e65..816993e 100644 --- a/appwidget-testing/src/main/java/com/google/android/glance/appwidget/testing/GlanceScreenshotTestActivity.kt +++ b/appwidget-testing/src/main/java/com/google/android/glance/appwidget/testing/GlanceScreenshotTestActivity.kt @@ -41,6 +41,12 @@ import kotlinx.coroutines.runBlocking * screenshot tests. * * See README.md for usage. + * + * NOTE: The device and screenshot framework you use should support hardware acceleration and + * `clipToOutline` to see rounded corners. For robolectric, see + * https://github.com/robolectric/robolectric/issues/8081#issuecomment-1478137890. + * When using an emulator, you may use Espresso's `captureToBitmap` to ensure that the corner radius + * is captured. */ @RequiresApi(Build.VERSION_CODES.O) public class GlanceScreenshotTestActivity : Activity() { diff --git a/sample/src/test/java/com/google/android/glance/tools/testing/SampleGlanceScreenshotTest.kt b/sample/src/test/java/com/google/android/glance/tools/testing/SampleGlanceScreenshotTest.kt index ad33c39..22a2c95 100644 --- a/sample/src/test/java/com/google/android/glance/tools/testing/SampleGlanceScreenshotTest.kt +++ b/sample/src/test/java/com/google/android/glance/tools/testing/SampleGlanceScreenshotTest.kt @@ -48,6 +48,11 @@ class SampleGlanceScreenshotTest { fun sampleGlanceContent() { renderComposable() + // NOTE: The rendering and screenshot framework you use should support hardware acceleration + // and `clipToOutline` to see rounded corners. For robolectric, see this + // [issue](https://github.com/robolectric/robolectric/issues/8081#issuecomment-1478137890). + // When using an emulator, you may use Espresso's `captureToBitmap` to ensure that the + // corner radius is captured. captureAndVerifyScreenshot("sample_content") }