awaitIdle

abstract suspend fun awaitIdle()

Suspends until the composition is idle, making the AWT tree reflect the latest state.

This is suspending rather than blocking, so recomposition can make progress while it waits. It returns once there is neither pending recomposition nor pending snapshot work AND the EDT queue has drained the runnables the settled composition scheduled - a window show that a Dialog { } defers to its own dispatch, for example, has landed by the time this returns.

With mainClock's autoAdvance at its default of true, reaching that state is this call's own job: it sends whatever frames are needed. With autoAdvance set to false, this drains the same pending work but sends no frame itself, so a composition parked waiting for one - mid-animation, or simply holding an unapplied recomposition - is exactly the state this returns on; call MainTestClock.advanceTimeByFrame or MainTestClock.advanceTimeBy to move it forward.

If the composition never settles within a generous frame cap, this fails with an AssertionError whose message names the outstanding work and includes a readable dump of the current AWT tree (including realized windows), rather than hanging until the surrounding test framework times out.

A failure the library itself raises on the event dispatch thread - reached from neither a recomposition nor a caller callback - fails this call with that failure rather than being lost to the thread's own uncaught-exception handler.