Skip to content

Instantly share code, notes, and snippets.

@davidvavra
Created December 27, 2021 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidvavra/b162dd73378edf9a5fa42fb2fd263066 to your computer and use it in GitHub Desktop.
Save davidvavra/b162dd73378edf9a5fa42fb2fd263066 to your computer and use it in GitHub Desktop.
@ShowkaseScreenshot(rootShowkaseClass = ShowkaseRoot::class)
abstract class ComposeTests : ShowkaseScreenshotTest {
override fun onScreenshot(
id: String,
name: String,
group: String,
styleName: String?,
screenshotType: ShowkaseScreenshotType,
screenshotBitmap: Bitmap
) {
val view = ImageView(InstrumentationRegistry.getInstrumentation().context)
view.setImageBitmap(screenshotBitmap)
ViewHelpers.setupView(view).setExactWidthPx(screenshotBitmap.width).setExactHeightPx(screenshotBitmap.height).layout()
Screenshot.snap(view).setName("$group - $name").record()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment