assertImagesPixelPerfect

fun ComposeSwingTest.assertImagesPixelPerfect(expected: BufferedImage, image: BufferedImage, maxDifferentPixels: Int = 0)

Asserts image matches expected pixel-for-pixel, allowing at most maxDifferentPixels differing pixels (default 0, i.e. byte-exact). Use this to prove two independently rendered components rasterize identically, where the tolerance of assertImageMatches would miss a stray border, margin or alignment shift.

Parameters

expected

the reference image.

image

the image under test.

maxDifferentPixels

the maximum number of pixels permitted to differ; 0 requires an exact match.

Throws

if the images differ in size, or differ in more than maxDifferentPixels pixels.