https://kotlinlang.org logo
#compose-android
Title
# compose-android
m

mattinger

05/25/2023, 4:51 AM
Does anyone know why this test would hang? I can tell that animations are turned off on my emulator (via the developer settings). However, when I use AndroidView like this with the “CircledLoadingDots”, it hangs. CircledLoadingDots is using an AnimatedVectorDrawable, which is why I suspect there’s an issue here. I just don’t know for sure, and am not sure how to fix it. I tried using ValueAnimator.areAnimatorsEnabled, but you have to be min api 26 to use that.
Copy code
class AnimationTest {
    @get:Rule
    val composeRule = createAndroidComposeRule<ComponentActivity>()

    @Test
    fun test() {
        composeRule.setContent {
                AndroidView(
                    modifier = Modifier
                        .fillMaxSize()
                        .testTag("loadingContentTag"),
                    factory = { context ->
                        CircledLoadingDots(context = context)
                    }
                )
        }

        composeRule.onRoot().printToString()
    }
}