You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m trying to work with the application module and Spek, so this is destined to fail, but anyways. Since #105 blocks me from using the Paparazzi Gradle plugin, I’m doing what the plugin does on my own.
describe("paparazzi") {
val paparazzi by memoized { Paparazzi() }
beforeEachTest {
val resourcesFile =File("REDACTED_MODULE_PATH/build/intermediates/paparazzi/resources.txt")
val resources =""" REDACTED_MODULE_PACKAGE_NAME REDACTED_MODULE_PATH/build/intermediates/res/merged/debug"""
resourcesFile.apply {
parentFile?.mkdirs()
createNewFile()
writeText(resources.trimIndent())
}
paparazzi.prepare(Description.createTestDescription(PaparazziSpec::class.java, "paparazzi"))
}
it("should work") {
paparazzi.snapshot(paparazzi.inflate(R.layout.view_basic), "basic")
}
afterEachTest {
paparazzi.close()
}
}
It actually compiles but fails to proceed.
kotlin.TypeCastException: null cannot be cast to non-null type V
at app.cash.paparazzi.Paparazzi.inflate(Paparazzi.kt:128)
at PaparazziSpec$1$1$2.invoke(PaparazziSpec.kt:42)
I’ve explored with a debugger a bit and seems like BridgeInflater#inflate returns null
since bridgeContext.getRenderResources().getResolvedResource(layoutInfo) returns null
since RenderResources#getResolvedResource returns null
since RenderResources#getUnresolvedResource returns null
since ResourceResolver#getUnresolvedResource returns null
since getResourceValueMap(reference.getNamespace(), reference.getResourceType()) returns empty map
The text was updated successfully, but these errors were encountered:
That's correct behavior at the moment, unfortunately. This stems from how application modules compile and merge resources vs how library modules does it. Explained here: #105
I’m trying to work with the application module and Spek, so this is destined to fail, but anyways. Since #105 blocks me from using the Paparazzi Gradle plugin, I’m doing what the plugin does on my own.
view_basic.xml
PaparazziSpec.kt
It actually compiles but fails to proceed.
I’ve explored with a debugger a bit and seems like
BridgeInflater#inflate
returnsnull
bridgeContext.getRenderResources().getResolvedResource(layoutInfo)
returnsnull
RenderResources#getResolvedResource
returnsnull
RenderResources#getUnresolvedResource
returnsnull
ResourceResolver#getUnresolvedResource
returnsnull
getResourceValueMap(reference.getNamespace(), reference.getResourceType())
returns empty mapThe text was updated successfully, but these errors were encountered: