paparazzi
paparazzi copied to clipboard
Hard to cleanly override SnapshotHandler
Attempting a temporary fix I tried to decorate the snapshot handler.
It seems awkward to do this currently, since determineHandler is private in Paparazzi.Companion.
@get:Rule
val paparazzi = Paparazzi(
deviceConfig = GALAXY_WATCH4_CLASSIC_LARGE,
theme = "android:ThemeOverlay.Material.Dark",
maxPercentDifference = 0.1,
snapshotHandler = WearSnapshotHandler(determineHandler(0.1))
)
private val isVerifying: Boolean =
System.getProperty("paparazzi.test.verify")?.toBoolean() == true
private fun determineHandler(maxPercentDifference: Double): SnapshotHandler =
if (isVerifying) {
SnapshotVerifier(maxPercentDifference)
} else {
HtmlReportWriter()
}
I won't need this after https://github.com/cashapp/paparazzi/pull/411, but I assume this is why it is there.
If I want to use my own custom SnapshotHandler, a lot of the types you need to do similar are also internal.
ImageUtils, Snapshot.toFileName and so on.
Is a good way to take this forward to show examples of where I want to use these? Or they will remain internal, and I should put PRs up to add features I'd like (nothing critical, just nice to haves).