DeviceConfigurationOverride


The specification for an override applied to some piece of content.

When wrapping content in Override, some particular override will be locally applied to the wrapped in order to test that content in isolation, without needing to configure the entire device.

Summary

Public functions

Unit
@Composable
Override(contentUnderTest: @Composable () -> Unit)

A wrapper around contentUnderTest that applies some override.

Cmn

Extension functions

infix DeviceConfigurationOverride

Combines this override with the other override into a single override, by applying this override as the outer override first, then the other override as an inner override, and then the content.

Cmn

Public functions

Override

@Composable
fun Override(contentUnderTest: @Composable () -> Unit): Unit

A wrapper around contentUnderTest that applies some override.

Implementations should call contentUnderTest exactly once.

Extension functions

infix fun DeviceConfigurationOverride.then(other: DeviceConfigurationOverride): DeviceConfigurationOverride

Combines this override with the other override into a single override, by applying this override as the outer override first, then the other override as an inner override, and then the content.

import androidx.compose.material.Text
import androidx.compose.ui.test.DeviceConfigurationOverride
import androidx.compose.ui.test.FontScale
import androidx.compose.ui.test.FontWeightAdjustment
import androidx.compose.ui.test.then

DeviceConfigurationOverride(
    DeviceConfigurationOverride.FontScale(1.5f) then
        DeviceConfigurationOverride.FontWeightAdjustment(200)
) {
    Text(text = "text with increased scale and weight")
}