SwingNodeInteractionCollection
A lazy handle to the set of components matched by a query. The match set is resolved against the live AWT tree each time it is needed, so it reflects the current tree.
T is the component type the query names - onAllNodesOfType<JLabel>() matches JLabels - and every step that keeps matching the same set keeps it, so fetchAll and the single-node handles get, onFirst, onLast and filterToOne carry it on. A query that names no type matches Components.
All methods are intended to be called from a org.jetbrains.compose.swing.test.runComposeSwingTest body, which runs on the EDT.
Functions
Asserts that every matched node satisfies matcher. An empty match set satisfies this, as there is no node that violates the matcher; pin the size with assertCountEquals where that matters.
Asserts that at least one matched node satisfies matcher. An empty match set fails.
Asserts that exactly expected nodes match.
Renders each matched component to its own off-screen image, in depth-first pre-order.
Resolves every matching component and returns them as the T the query named, in depth-first pre-order, for reading or driving each component's own API (e.g. a JList's model, a JSplitPane's divider). A query that named the type does not name it again:
Resolves every matching component and returns them typed as R, in depth-first pre-order, for a query that named no type of its own - or that named a wider one than the components to be driven.
Returns a collection of the matches that also satisfy matcher. Like every interaction, the returned handle re-resolves against the live tree on each use, so it tracks recomposition.
Returns a lazy handle to the single match that also satisfies matcher; it fails on use when the filtered set does not hold exactly one node.
Returns a lazy handle to the match at index, in depth-first pre-order. Like every interaction, the handle re-resolves against the live tree on each use, so it tracks matches added or removed by recomposition; it fails on use when fewer than index + 1 nodes match.
Returns a lazy handle to the first match, in depth-first pre-order. Convenience for get(0).
Returns a lazy handle to the last match, in depth-first pre-order. The handle re-resolves against the live tree on each use, so it tracks the current last match across recomposition; it fails on use when nothing matches.