awaitEventsDelivered

abstract suspend fun awaitEventsDelivered()

Suspends until every AWT notification already queued on the event dispatch thread has been dispatched, without producing a composition frame.

A frame is what lets the composition recompose and apply its changes, so withholding one takes apart the two things awaitIdle settles together. Once this returns, whatever the widgets reported has run - a listener callback, a runnable a widget scheduled for itself - and no recomposition can have contributed to what the AWT tree now shows. A test that has to tell "the widget told us" apart from "a recomposition happened" asserts between this gate and awaitIdle.

Snapshot writes those callbacks make stay pending, so the tree still shows the state of the last frame; awaitIdle lets it catch up.

Draining is bounded as in awaitIdle: a source of scheduled work that never quiesces fails with an AssertionError carrying a tree dump rather than spinning forever, and a failure the library itself raises on the event dispatch thread fails this call the same way awaitIdle does.