Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Can't wrap nullptr" thrown from within skiko in compose jvm desktop test when using dialogs #244

Open
ZacSweers opened this issue Jan 16, 2024 · 3 comments

Comments

@ZacSweers
Copy link
Contributor

ZacSweers commented Jan 16, 2024

Repro: slackhq/circuit#1121

Version: 1.9.0-alpha-4

File: circuitx/overlays/src/jvmTest/kotlin/com/slack/circuitx/overlays/OverlaySnapshotTests.kt

Trace:

java.lang.RuntimeException: Can't wrap nullptr
	at org.jetbrains.skia.impl.Native.<init>(Native.jvm.kt:40)
	at org.jetbrains.skia.impl.Managed.<init>(Managed.jvm.kt:12)
	at org.jetbrains.skia.impl.RefCnt.<init>(RefCnt.jvm.kt:6)
	at org.jetbrains.skia.Image.<init>(Image.kt:6)
	at org.jetbrains.skia.Surface.makeImageSnapshot(Surface.kt:762)
	at androidx.compose.ui.test.SkikoComposeUiTest.captureToImage(ComposeUiTest.skikoMain.kt:343)
	at androidx.compose.ui.test.SkikoComposeUiTest.captureToImage(ComposeUiTest.skikoMain.kt:348)
	at io.github.takahirom.roborazzi.RoborazziDesktopKt.captureRoboImage(RoborazziDesktop.kt:39)
	at io.github.takahirom.roborazzi.RoborazziDesktopKt.captureRoboImage(RoborazziDesktop.kt:23)
	at io.github.takahirom.roborazzi.RoborazziDesktopKt.captureRoboImage$default(RoborazziDesktop.kt:16)
	at com.slack.circuitx.overlays.OverlaySnapshotTests$alertDialog$1.invoke(OverlaySnapshotTests.kt:62)
	at com.slack.circuitx.overlays.OverlaySnapshotTests$alertDialog$1.invoke(OverlaySnapshotTests.kt:34)
	at androidx.compose.ui.test.SkikoComposeUiTest.runTest(ComposeUiTest.skikoMain.kt:170)
	at androidx.compose.ui.test.ComposeUiTest_desktopKt.runDesktopComposeUiTest(ComposeUiTest.desktop.kt:41)
	at androidx.compose.ui.test.ComposeUiTest_desktopKt.runDesktopComposeUiTest$default(ComposeUiTest.desktop.kt:34)
	at com.slack.circuitx.overlays.OverlaySnapshotTests.alertDialog(OverlaySnapshotTests.kt:34)
@takahirom
Copy link
Owner

I've seen this before. It might be because you're using the window. Could you try using an inner Composable function instead? However, this may not be what you're looking for.

@takahirom takahirom changed the title "Can't wrap nullptr" thrown from within skiko in multiplatform compose test "Can't wrap nullptr" thrown from within skiko in compose jvm desktop test when using dialogs Jan 16, 2024
@ZacSweers
Copy link
Contributor Author

Can you clarify what you mean by "inner composable function"?

@takahirom
Copy link
Owner

The inner composable function refers to taking a screenshot of the Composable function's content inside a dialog. However, I understand that this may not be what you, as the creator of a dialog display library, are looking for. When I tried it before, it was challenging to capture content from outside a Window on Desktop, so this issue might not be resolved quickly. It might be addressed as soon as a way is found to capture images per window or to effectively combine them per window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants