Closed fcastagnozzi-ta closed 3 months ago
@fcastagnozzi-ta Thank you for reporting this issue. There are a few options to resolve this. You can use ComposeRule and specify the Activity. However, I think it would be easier to provide LocalContext in the test. You can use ContextThemeWrapper to wrap the existing context. It appears that Compose's AndroidView uses LocalContext to create the View. https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/viewinterop/AndroidView.android.kt;l=269?q=AndroidView
I see, that looks like it should work. Thanks!
Using
captureRoboImage
with something likedoesn't work because the MaterialButton button expects to get its attributes from the activity's theme, but the capture happens on RoborazziTransparentActivity which has its own theme. Would need a way to provide our own activity or theme.