cashapp / paparazzi

Render your Android screens without a physical device or emulator
https://cashapp.github.io/paparazzi/
Apache License 2.0
2.32k stars 216 forks source link

`AccessibilityRenderExtension` with `renderingMode = SHRINK` error: `IllegalArgumentException: Layout` #1579

Closed yogurtearl closed 2 months ago

yogurtearl commented 2 months ago

This is a pure compose screenshot using Compose 1.7.1 and paparazzi 1.3.4

When using renderingMode = SHRINK and trying to add in AccessibilityRenderExtension() to an existing screen shot, we get this error.

It does adds the colored boxes, but doesn't added the side panel with all the accessibility labels.

Oddly, it also doubles the screenWidth that this set in a custom device config.

without renderingMode = SHRINK it works as expected.

    java.lang.IllegalArgumentException: Layout: -56 < 0
        at android.text.Layout.<init>(Layout.java:304)
        at android.text.StaticLayout.<init>(StaticLayout.java:634)
        at android.text.StaticLayout$Builder.build(StaticLayout.java:444)
        at app.cash.paparazzi.accessibility.AccessibilityOverlayDetailsView.draw(AccessibilityOverlayDetailsView.kt:79)
        at android.view.View.draw_Original(View.java:23762)
        at android.view.View_Delegate.draw(View_Delegate.java:68)
        at android.view.View.draw(View.java:23540)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4556)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4317)
        at android.view.View.draw_Original(View.java:23760)
        at android.view.View_Delegate.draw(View_Delegate.java:68)
        at android.view.View.draw(View.java:23540)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4556)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4317)
        at android.view.View.draw_Original(View.java:23760)
        at android.view.View_Delegate.draw(View_Delegate.java:68)
        at android.view.View.draw(View.java:23540)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4556)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4317)
        at android.view.View.draw_Original(View.java:23760)
        at android.view.View_Delegate.draw(View_Delegate.java:68)
        at android.view.View.draw(View.java:23540)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4556)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4317)
        at android.view.View.draw_Original(View.java:23760)
        at android.view.View_Delegate.draw(View_Delegate.java:68)
        at android.view.View.draw(View.java:23540)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4556)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4317)
        at android.view.View.draw_Original(View.java:23892)
        at android.view.View_Delegate.draw(View_Delegate.java:56)
        at android.view.View.draw(View.java:23862)
        at com.android.layoutlib.bridge.impl.RenderSessionImpl.renderAndBuildResult(RenderSessionImpl.java:558)
        at com.android.layoutlib.bridge.impl.RenderSessionImpl.render(RenderSessionImpl.java:445)
        at app.cash.paparazzi.PaparazziSdk$takeSnapshots$3.invoke(PaparazziSdk.kt:289)
        at app.cash.paparazzi.PaparazziSdk$takeSnapshots$3.invoke(PaparazziSdk.kt:288)
        at app.cash.paparazzi.PaparazziSdk.withTime(PaparazziSdk.kt:340)
        at app.cash.paparazzi.PaparazziSdk.takeSnapshots(PaparazziSdk.kt:288)
        at app.cash.paparazzi.PaparazziSdk.snapshot(PaparazziSdk.kt:179)
        at app.cash.paparazzi.PaparazziSdk.snapshot$default(PaparazziSdk.kt:178)
        at app.cash.paparazzi.PaparazziSdk.snapshot(PaparazziSdk.kt:174)
        at app.cash.paparazzi.Paparazzi.snapshot(Paparazzi.kt:103)
        at app.cash.paparazzi.Paparazzi.snapshot$default(Paparazzi.kt:100)
geoff-powell commented 2 months ago

Closing as its a duplicate of #1350