Package-level declarations

Functions

Link copied to clipboard
fun ComposeSwingTest.assertImageAgainstGolden(goldenIdentifier: String, threshold: Double = MSSIMMatcher.DEFAULT_THRESHOLD)

Captures the whole composition root and asserts it matches the stored golden image identified by goldenIdentifier.

fun SwingNodeInteraction<*>.assertImageAgainstGolden(goldenIdentifier: String, threshold: Double = MSSIMMatcher.DEFAULT_THRESHOLD)

Captures the matched component and asserts it matches the stored golden image identified by goldenIdentifier, failing the test on a visual difference.

fun ComposeSwingTest.assertImageAgainstGolden(image: BufferedImage, goldenIdentifier: String, threshold: Double = MSSIMMatcher.DEFAULT_THRESHOLD)

Asserts an already-captured image against the golden image identified by goldenIdentifier. Use this when the image was produced by captureToImage and possibly post-processed before comparing.

Link copied to clipboard
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.

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.

Link copied to clipboard
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.

Link copied to clipboard

Renders an arbitrary, hand-built raw AWT/Swing component to an off-screen image, independently of any composition.

Renders the whole composition root, together with everything drawn inside it, to an off-screen image. Equivalent to capturing the node returned by ComposeSwingTest.onRoot.

Renders the matched component, together with everything drawn inside it, to an off-screen image.

Link copied to clipboard

Renders each matched component to its own off-screen image, in depth-first pre-order.