Skip to content

Some similar snapshots falsely pass even with maxPercentDifference set to zero #2075

@matejdro

Description

@matejdro

Description

It seems that in some cases, Paparazzi will ignore the maxPercentDifference = 0.0 and will falsely pass the tests, even when the recorded image differs from the new image.

This seems to be happening when the result of the comparion is the DiffResult.Similar. It appears percentage is not forwarded in this case, but always hardcoded as zero:

Steps to Reproduce

  1. Record the snapshot with the following test:
class BugDemo {

    @get:Rule
    val paparazzi: Paparazzi = Paparazzi(deviceConfig = DeviceConfig.NEXUS_5, maxPercentDifference = 0.0)

    @Test
    fun test() {
        paparazzi.snapshot {
            Box(Modifier.size(1024.dp).background(Color.Black).padding(100.dp)) {
                Box(Modifier.size(400.dp, 1.dp).background(Color.White))
            }
        }
    }
}
  1. Change the width of the inner box from 400.dp to the 390.dp
  2. Run the verify task

Expected behavior

When maxPercentDifference is set to 0.0, then any change in the image should fail the verification, no matter how small

Additional information:

  • Paparazzi Version: 1.3.5
  • OS: Linux
  • Compile SDK: 35
  • Gradle Version: 8.11.1
  • Android Gradle Plugin Version: 8.10.0

Screenshots

Image

Paparazzi does not detect line slightly shrinking in the above image

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions