performClick

suspend fun <T : Component> SwingNodeInteraction<T>.performClick(position: Point? = null, button: Int = MouseEvent.BUTTON1, clicks: Int = 1, modifiers: Int = 0): SwingNodeInteraction<T>

Clicks the primary mouse button on the matched node at position, then settles the composition. position defaults to the middle of the node, in the node's own coordinates.

The gesture is the press, the release and the MOUSE_CLICKED the toolkit delivers for one click, each from an event-queue cycle of its own, so the node's own UI decides what the click means exactly as it does for a user: a click on a laid-out javax.swing.AbstractButton fires its action because the UI's own listener fires it, not because the test asked the button to.

button names which button is clicked, clicks how many times - 2 is a double click, delivered as the toolkit delivers one, each click carrying its running count - and modifiers the keys held throughout, which is how a shift- or control-click extends a selection. The platform's context-menu gesture is performContextClick, which carries the popup trigger a secondary click alone does not.

A click lands where a user's click would land. Aimed outside the node's bounds, or at a node that has no size because nothing laid it out, the UI resolves it to nothing and the node does not react.

Return

this interaction, for chaining a further gesture or assertion.

Parameters

position

the point every event of the click carries, so press, release and click all land together.

button

a MouseEvent.BUTTON* constant; the primary button by default.

clicks

the number of clicks in the gesture, one by default; fewer than one is rejected.

modifiers

a mask of InputEvent.*_DOWN_MASK values, none by default.