Christophe Dongieux
07/18/2024, 4:10 PM@Composable
fun CheckBox() {
Box(
modifier = Modifier
.size(32.dp)
.background(Color.Red)
.toggleable(
value = true,
enabled = true,
role = Role.Checkbox,
onValueChange = {}
)
)
}
@Test
fun testToggleableCheckBox() {
composeTestRule.setContent {
CheckBox()
}
composeTestRule
.onRoot()
.assertIsToggleable()
}
java.lang.AssertionError: Failed to assert the following: (ToggleableState is defined)
Semantics of the node:
Node #1 at (l=0.0, t=279.0, r=84.0, b=363.0)px
Has 1 child
Selector used: (isRoot)
Even though the layout inspector says the ToggleableState is on.
What I am missing?Zach Klippenstein (he/him) [MOD]
07/18/2024, 4:30 PMBox
Christophe Dongieux
07/22/2024, 2:02 PM