Repository navigation
Compose runtime does not work in Paparazzi/JVM screenshot tests #460
Copy link
Copy link
Open
Description
Description
The new Compose runtime path (rememberRiveWorker(), rememberRiveFile(), Rive(...)) does not work in Paparazzi/JVM screenshot tests.
This makes it hard to add screenshot coverage for Compose screens that use Rive. Today we have to replace Rive with placeholders/static stand-ins in Paparazzi instead of rendering the actual animation output.
This seems related to Rive's broader Compose testing support, but different from #444:
- Rive composable causes ComposeNotIdleException in Espresso/Compose UI tests due to infinite withFrameNanos loop #444 = Compose UI test / Espresso idleness once the runtime is already running
- this issue = the runtime fails during initialization in a JVM screenshot-test environment
Minimal repro
@Test
fun riveCompose_screenshot() {
paparazzi.snapshot {
MaterialTheme {
NativeThumbsUpRive(modifier = Modifier.size(96.dp))
}
}
}
@Composable
private fun NativeThumbsUpRive(modifier: Modifier = Modifier) {
val worker = rememberRiveWorker()
when (val fileResult = rememberRiveFile(RiveFileSource.RawRes.from(R.raw.thumbs_up), worker)) {
is Result.Success -> {
Rive(
file = fileResult.value,
modifier = modifier,
playing = true,
)
}
else -> Unit
}
}Actual result
The runtime fails to initialize:
app.rive.RiveInitializationException: Failed to create Rive worker
Caused by: java.lang.RuntimeException: Method eglGetDisplay in android.opengl.EGL14 not mocked.
See https://developer.android.com/r/studio-ui/build/not-mocked for details.
at android.opengl.EGL14.eglGetDisplay(EGL14.java)
at app.rive.core.RenderContextGL$Companion.createDisplay(RenderContext.kt:125)
at app.rive.core.RenderContextGL.<init>(RenderContext.kt:105)
at app.rive.core.CommandQueue.<init>(CommandQueue.kt:137)
at app.rive.RememberRiveWorkerKt.createRiveWorker(rememberRiveWorker.kt:157)
at app.rive.RememberRiveWorkerKt.rememberRiveWorker(rememberRiveWorker.kt:57)
Expected result
Either:
- the Compose runtime should work in Paparazzi/layoutlib/JVM screenshot tests, or
- this environment should be documented as unsupported
Why this matters
Paparazzi is a common screenshot-test stack for Android Compose UI. Without support for this environment, teams using the new Compose runtime cannot verify actual Rive output in screenshot tests and have to fall back to placeholders or device-only coverage.
Related
- Rive composable causes ComposeNotIdleException in Espresso/Compose UI tests due to infinite withFrameNanos loop #444 — Compose UI test / Espresso idleness with the Compose runtime
- java.lang.UnsatisfiedLinkError: No implementation found for long app.rive.runtime.kotlin.core.FileAssetLoader.constructor #316 — historical test-environment failure on an older runtime path
Versions
- observed on
rive-android11.6.1 and 11.7.0 - Compose runtime path only (
rememberRiveWorker()+rememberRiveFile()+Rive(...))
Metadata
Metadata
Assignees
Labels
No labels
Activity