Skip to content

Commit

Permalink
Add a note indicating that corner radius will not show up in screensh…
Browse files Browse the repository at this point in the history
…ots if hardware acceleration / clipToOutline is not supported (it may depend on rendering framework / screenshot framework). With robolectric+roborazzi, it doesn't seem to work currently (remoteviews use clipToOutline). However, one can use a emulator and take screenshot with hardware bitmap if they'd like corner radius to appear).
  • Loading branch information
shamalip committed Jan 2, 2024
1 parent f73f95d commit 945aa96
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion appwidget-testing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ 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)
[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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ import kotlinx.coroutines.runBlocking
*
* 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
* 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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ class SampleGlanceScreenshotTest {
fun sampleGlanceContent() {
renderComposable()

// NOTE: The device and screenshot framework you use should support hardware acceleration
// 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).
// [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")
}

Expand Down

0 comments on commit 945aa96

Please sign in to comment.