captureToImage
Renders the matched component, together with everything drawn inside it, to an off-screen image.
The component must be displayed (laid out with a non-zero size); this is the same contract as SwingNodeInteraction.assertIsDisplayed. Call after the composition has settled so the captured image reflects the latest state.
Return
an image whose width and height match the component's laid-out size.
Throws
if the component is not displayed.
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.
Return
an image whose width and height match the root's laid-out size.
Throws
if the root has a zero laid-out size.
Renders an arbitrary, hand-built raw AWT/Swing component to an off-screen image, independently of any composition.
This is the raw-Swing counterpart of SwingNodeInteraction.captureToImage: it renders a hand-written reference component (e.g. a plain JButton) through the same pipeline used for composed components, so the two images can be compared pixel-for-pixel. The component and its whole subtree are laid out here, at the size it already carries or at its preferred size when it carries none - so give it the size of the composed component you are comparing against, and both images share identical dimensions.
Return
an image whose width and height match the size the component was rendered at.
Throws
if the component has neither a size nor a preferred size.