0

I have an application written in compose and I want to test it's background based on state stored in viewmodel and interaction with the composable item, like:

 Box(
                modifier = Modifier
                    .background(
                        color = if (entry == chartDataType) Color.White else Color.Transparent,
                        shape = RoundedCornerShape(4.dp)
                    )
                    .clickable {
                        callBack?.invoke(entry)
                    }
                    .padding(4.dp)
                    .testTag(entry.name)
            ) {
                Text(
                    text = stringResource(id = entry.sourceValue), lineHeight = 1.54.em,
                    style = TextStyle(
                        fontSize = 13.sp
                    ), color = if (entry == something) Color(0xFF474D56) else Color(0xFF8C8C8C)
                )
            }

I have seen this, but I think it's not very much useful, doesn't it encounter with text color?, what if the background was a gradient, or what if I wanted to check the color/font of the text?

0