Package-level declarations

Types

Link copied to clipboard
sealed interface MouseInjectionScope

Records mouse input at positions in the matched component's coordinates.

Link copied to clipboard

A lazy handle to the single component targeted by a query. The target is resolved against the current AWT tree each time it is needed, so it always reflects the current tree after recomposition.

Link copied to clipboard

A lazy handle to the set of components matched by a query. The match set is resolved against the current AWT tree each time it is needed, so it reflects the current tree.

Link copied to clipboard

A lazy handle to the single top-level window targeted by a window query. The target is resolved against the current set of realized windows each time it is needed, so it always reflects windows appearing and disappearing across recomposition.

Link copied to clipboard

A lazy handle to the set of realized windows matched by a window query. The match set is resolved against the current set of realized windows each time it is needed, so it reflects windows appearing and disappearing across recomposition.

Functions

Link copied to clipboard

Asserts that the matched node is an R, and returns this interaction typed as R so the assertions and properties after it are written against R:

Asserts that the matched window is an R, and returns this interaction typed as R so the assertions and properties after it are written against R:

Link copied to clipboard
fun <T : Component, V> SwingNodeInteraction<T>.assertProperty(expected: V, message: String? = null, actual: T.() -> V): SwingNodeInteraction<T>

Asserts that the value actual reads off the matched node equals expected, and returns this interaction for chaining.

fun <T : Window, V> SwingWindowInteraction<T>.assertProperty(expected: V, message: String? = null, actual: T.() -> V): SwingWindowInteraction<T>

Asserts that the value actual reads off the matched window equals expected, and returns this interaction for chaining.

Link copied to clipboard
suspend fun <T : Component> SwingNodeInteraction<T>.assertTreeMatches(expected: Component, allowSubclasses: Boolean = true): SwingNodeInteraction<T>

Asserts that the matched node and expected describe the same user interface - the same widgets, nested the same way, holding the same state - and returns this interaction for chaining.

Link copied to clipboard
fun MouseInjectionScope.click(position: Point = center, button: Int = MouseEvent.BUTTON1)

Clicks at position with button.

Link copied to clipboard
fun MouseInjectionScope.contextClick(position: Point = center)

Clicks the secondary button at position.

Link copied to clipboard

Returns a handle to the matched node's ancestors, nearest first, up to and including the root the node was found under. A node that is itself a root yields an empty collection.

Link copied to clipboard

Returns a handle to the matched node's only direct child. Resolution fails unless the node holds exactly one child.

Link copied to clipboard

Returns a handle to the matched node's direct child at index. Convenience for onChildren()[index].

Link copied to clipboard

Returns a handle to the matched node's children, in their container's order. A node with no children yields an empty collection.

Link copied to clipboard

Returns a handle to every component below the matched node, at any depth, in depth-first pre-order. The node itself is excluded, which is how a query scopes to one subtree:

Link copied to clipboard

Returns a handle to the parent of the matched node.

Link copied to clipboard

Returns a handle to the matched node's only sibling. Resolution fails unless the node's parent holds exactly two children.

Link copied to clipboard

Returns a handle to the matched node's siblings: every other child of its parent, in the parent's order. A node with no parent yields an empty collection.

Link copied to clipboard

Performs the accessible action whose description equals description and awaits idle. The description is the one the component reports for the action, which a look and feel may localize: a button reports the AbstractButton.clickText default of the look and feel, and a spinner reports AccessibleAction.INCREMENT. Pass the description in the consumer JVM's locale.

Link copied to clipboard

Adds the accessible child at index to the selection and awaits idle. Selection is checked immediately; settlement may restore the declared selection afterward.

Link copied to clipboard
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 awaits idle. position defaults to the middle of the node, in the node's own coordinates.

Link copied to clipboard

Makes the platform's context-menu gesture on the matched node at position, then awaits idle. position defaults to the middle of the node, in the node's own coordinates.

Link copied to clipboard

Delivers the event event builds for the matched node, then awaits idle.

Link copied to clipboard

Delivers a focus-gained notification to the matched node and awaits idle.

Link copied to clipboard

Delivers a focus-lost notification to the matched node and awaits idle.

Link copied to clipboard
suspend fun <T : Component> SwingNodeInteraction<T>.performKeyPress(keyCode: Int, modifiers: Int = 0): SwingNodeInteraction<T>

Presses and releases the key keyCode on the matched node, holding modifiers for both, then awaits idle. keyCode is a KeyEvent.VK_* constant and modifiers a mask of InputEvent.*_DOWN_MASK values, empty by default.

Link copied to clipboard

Drags the primary mouse button across the matched node from from to to, then awaits idle. Both points are in the node's own coordinates.

Link copied to clipboard

Brings the pointer onto the matched node at position and awaits idle. position defaults to the middle of the node, in the node's own coordinates.

Link copied to clipboard

Takes the pointer off the matched node at position and awaits idle. position defaults to the middle of the node, in the node's own coordinates.

Link copied to clipboard

Posts mouse events through the node's showing window and awaits idle after the block. Positions use the node's coordinates. Pointer position and held buttons carry over between calls. Events are posted after the block, one event queue turn apart. A failed call leaves the gesture state undefined for the rest of the test.

Link copied to clipboard

Moves the pointer to position over the matched node, then awaits idle. position is in the node's own coordinates.

Link copied to clipboard

Presses the primary mouse button on the matched node at position, then awaits idle. position defaults to the middle of the node, in the node's own coordinates.

Link copied to clipboard

Releases the primary mouse button on the matched node at position, then awaits idle. position defaults to the middle of the node, in the node's own coordinates.

Link copied to clipboard
suspend fun <T : Component> SwingNodeInteraction<T>.performMouseWheel(rotation: Int, position: Point? = null): SwingNodeInteraction<T>

Turns the mouse wheel over the matched node by rotation notches - negative away from the user, positive toward them - then awaits idle. position defaults to the middle of the node, in the node's own coordinates.

Link copied to clipboard

Sets the accessible value and awaits idle. The component applies its own range and listener rules.

Link copied to clipboard

Clicks the tab at index on the matched JTabbedPane and awaits idle.

Link copied to clipboard

Types text onto the end of the matched JTextComponent's current content, then awaits idle.

Link copied to clipboard

Pastes text into the matched JTextComponent over its current selection, then awaits idle.

Link copied to clipboard

Replaces the matched JTextComponent's entire content with text, then awaits idle.

Link copied to clipboard

Types text on the matched node one character at a time, then awaits idle.