assertImageMatches

fun ComposeSwingTest.assertImageMatches(expected: BufferedImage, image: BufferedImage, threshold: Double = MSSIMMatcher.DEFAULT_THRESHOLD)

Asserts an already-captured image matches expected by structural similarity at threshold, without involving any golden file. Useful for comparing two captured or synthesized images directly inside a test.

Parameters

expected

the reference image.

image

the image under test.

threshold

the structural-similarity acceptance floor, where higher is stricter.

Throws

if image differs from expected beyond the threshold, or if their sizes differ.


fun SwingNodeInteraction<*>.assertImageMatches(expected: BufferedImage, threshold: Double = MSSIMMatcher.DEFAULT_THRESHOLD)

Captures the matched component and asserts it matches expected by structural similarity at threshold, without involving any golden file.

Parameters

expected

the reference image.

threshold

the structural-similarity acceptance floor, where higher is stricter.

Throws

if the captured image differs from expected beyond the threshold, or if their sizes differ.