ComposeExecutionControl

interface ComposeExecutionControl
androidx.ui.test.ComposeExecutionControl

Test scope accessible from execution controlled tests to test compose.

Summary

Public methods

abstract Unit

To be used for tests debugging.

abstract Unit

Performs the full frame.

abstract Unit

Performs full draw.

abstract Boolean

Whether there are pending changes in the composition.

abstract Unit

Performs layout.

abstract Unit

Performs measure.

abstract Unit

Performs recomposition if needed.

Extension functions

From androidx.ui.test
Unit

Performs recomposition and asserts that there were some pending changes.

Unit

Asserts that last recomposition had some changes.

Unit

Asserts that last recomposition had no some changes.

Unit

Assert that the underlying view under test has a positive size.

Unit

Performs recomposition and asserts that there were some pending changes.

Unit

Performs the given amount of frames and asserts that there are no changes pending afterwards.

Int

Runs frames until there are no changes pending.

Unit

Performs recomposition and asserts that there were some pending changes.

Properties

abstract Boolean

Whether the last frame / recompose had changes to recompose.

abstract Int

The measured height of the underlying view.

abstract Int

The measured width of the underlying view.

Public methods

capturePreviewPictureToActivity

abstract fun capturePreviewPictureToActivity(): Unit

To be used for tests debugging.

Draws the view under test into image view and places it in the current Activity. That will also replace the current content under test. This can be useful to verify / preview results of your time controlled tests.

doFrame

abstract fun doFrame(): Unit

Performs the full frame.

This also sets up the content in case the content was not set up before.

Following steps are performed

  1. Recompose
  2. Measure
  3. Layout
  4. Draw

drawToBitmap

abstract fun drawToBitmap(): Unit

Performs full draw.

Note that the performance is not close to real draw (unless running Q+).

hasPendingChanges

abstract fun hasPendingChanges(): Boolean

Whether there are pending changes in the composition.

layout

abstract fun layout(): Unit

Performs layout.

Note that this does not do any invalidation.

measure

abstract fun measure(): Unit

Performs measure.

Note that this does not do any invalidation.

recompose

abstract fun recompose(): Unit

Performs recomposition if needed.

Note this is also called as part of doFrame

Properties

didLastRecomposeHaveChanges

abstract val didLastRecomposeHaveChanges: Boolean

Whether the last frame / recompose had changes to recompose.

measuredHeight

abstract val measuredHeight: Int

The measured height of the underlying view.

measuredWidth

abstract val measuredWidth: Int

The measured width of the underlying view.