cashapp / paparazzi

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

`AccessibilityRenderExtension` doesn't work correctly with `RenderingMode.SHRINK` #1350

Open VirtualParticle opened 3 months ago

VirtualParticle commented 3 months ago

Description Using the AccessibilityRenderExtension is useful for analyzing accessibility information, but the information added to the side of the screenshot is cropped out when the SHRINK rendering mode is used.

Steps to Reproduce Here is an example test:

class ExampleTest {

    @get:Rule
    val paparazzi = Paparazzi(
        renderingMode = RenderingMode.SHRINK,
        renderExtensions = setOf(AccessibilityRenderExtension()),
    )

    @Test
    fun exampleTest() {
        paparazzi.snapshot {
            Box(
                modifier = Modifier
                    .background(Color.White)
                    .padding(16.dp)
            ) {
                Text(text = "Hello, world!")
            }
        }
    }

}

Expected behavior I would expect for the accessibility information on the side of the screenshot to be included in the cropped screenshot, that is to say that the crop would take into account the size of the accessibility information, even if it was taller than the actual content.

Additional information:

Screenshots Screenshot using SHRINK: image

Screenshot using NORMAL: image

I've given fixing this a look and it seems like one of the challenges here is that the accessibility information is a canvas element which can't easily use things like WRAP_CONTENT.

MedetZhakupov commented 2 months ago

Is it considered blocker for the release 1.3.4 @adamalyyan ?

adamalyyan commented 2 months ago

I don't think this would be considered a blocker but I'll defer to @geoff-powell as his PR will resolve this!

geoff-powell commented 2 months ago

Ya I think this might not make 1.3.4. Need to figure out a better way to render accessibility information in a layout so we can correctly measure the details view.