paparazzi icon indicating copy to clipboard operation
paparazzi copied to clipboard

Gif support for Compose

Open JavierSegoviaCordoba opened this issue 2 years ago • 4 comments

Paparazzi hasn't Gif support for Compose, it should be great if it was added.

Is it possible, as a workaround, to wrap the composable with AndroidView?

JavierSegoviaCordoba avatar Jul 13 '22 13:07 JavierSegoviaCordoba

In the meantime, this totally works:

val view = ComposeView(paparazziRule.context)
view.setContent {
    PaparazziTestTheme(darkTheme = true) {
        Page()
    }
}
paparazziRule.gif(view, "test", 0L, 500L, 30)

redwarp avatar Sep 05 '23 10:09 redwarp

In the meantime, this totally works:

val view = ComposeView(paparazziRule.context)
view.setContent {
    PaparazziTestTheme(darkTheme = true) {
        Page()
    }
}
paparazziRule.gif(view, "test", 0L, 500L, 30)

Well, it worked but, It generated a .mov file instead of a .gif in the videos folder. Also, it generated a bunch of images in the screenshot folder, which I would assume that these are the .gif frames. Is that the expected result?? image

lib version used: 1.3.1

hlandim avatar Sep 06 '23 08:09 hlandim

Yep, if you look at the source code, that is expected: https://github.com/cashapp/paparazzi/blob/master/paparazzi/src/main/java/app/cash/paparazzi/HtmlReportWriter.kt. The way it works is that every frame is generated, and then assembled in a video.

Arguably, it could be cleaned.

As of now, the snapshot verifier does not verify videos, just fixed images: https://github.com/cashapp/paparazzi/blob/master/paparazzi/src/main/java/app/cash/paparazzi/SnapshotVerifier.kt

redwarp avatar Sep 06 '23 09:09 redwarp

Note that there are some gif related PRs open, some might be related: https://github.com/cashapp/paparazzi/pulls?q=is%3Apr+is%3Aopen+gif

TWiStErRob avatar Sep 07 '23 08:09 TWiStErRob