Hello - I'm looking to create my own shadow for a framework-level class, ViewRootImpl. My current shadow extends the one included in Robolectric 4.9.2, and add some additional functionality:
@Implements(value = ViewRootImpl::class)
class GestureInsetsViewRootImpl : ShadowViewRootImpl() {
@Implementation
@Suppress("UNUSED_PARAMETER")
fun getWindowInsets(forceConstruct: Boolean): WindowInsets {
val compatInsets = Insets.of(Rect(100, 0, 100, 0))
return WindowInsetsCompat.Builder()
.setInsets(WindowInsetsCompat.Type.systemGestures(), compatInsets)
.build()
.toWindowInsets()!!
}
}
To allow my project to reference
ViewRootImpl, I included the
android-all library. However, having this on my classpath seems to be stomping on some framework classes in ways that result in runtime exceptions. For example, my Android Log calls now result in linking errors.
1.) Am I going about creating a framework-level Shadow in the correct way?
2.) I noticed other interesting-sounding libraries surrounding Robolectric e.g. shadows-framework, shadowapi, and sandbox. Should I be including android-all-instrumented instead? Where can I learn more about these?
Thanks for any help!