setContent

abstract fun setContent(content: @Composable () -> Unit)

Sets the composable content of the test root and waits until the composition is idle so the AWT tree reflects the initial state before returning. May be called only once per test.

This wait depends on mainClock's autoAdvance exactly as awaitIdle does: with it at its default of true this call sends whatever frames the composition needs, but with it false no frame is sent here either, so an effect gated on the first withFrameNanos - a frame-driven animation started from initial composition, for instance - stays parked until the test calls MainTestClock.advanceTimeByFrame or MainTestClock.advanceTimeBy itself.

It fails the same way awaitIdle does, an effect the initial composition launches included.

Parameters

content

composed into root on the event dispatch thread, under this test's lifecycleState.

Throws

if called more than once per test.