Function

assertWidthIsEqualTo

Asserts that the layout of this node has width equal to expectedWidth.

assertWidthIsEqualTo

Source set: Common
@Deprecated(message = "Use assertWidthIsEqualTo with tolerance", level = DeprecationLevel.HIDDEN)
public fun SemanticsNodeInteraction.assertWidthIsEqualTo(
    expectedWidth: Dp
): SemanticsNodeInteraction

Asserts that the layout of this node has width equal to expectedWidth.

Throws: AssertionError

if comparison fails.

assertWidthIsEqualTo

Source set: Common
public fun SemanticsNodeInteraction.assertWidthIsEqualTo(
    expectedWidth: Dp,
    tolerance: Dp = Dp.Unspecified,
): SemanticsNodeInteraction

Asserts that the layout of this node has width equal to expectedWidth within the given tolerance.

Parameters

expectedWidth The expected width of the layout.
tolerance The tolerance within which the values should be treated as equal. Defaults to the tolerance configured in ComposeUiTestConfig, or 0.5.dp if unspecified.

Throws: AssertionError

if comparison fails.

Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: