-
Notifications
You must be signed in to change notification settings - Fork 38
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
Fix alert dialog support #555
Conversation
e766cd7
to
17ef64c
Compare
Snapshot diff report
|
…alertdialog-test/2024-11-15
…alertdialog-test/2024-11-15
} | ||
|
||
@InternalRoborazziApi | ||
fun fetchRobolectricWindowRoots(): List<Root> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the method we use for captureScreenRoboImage()
to fetch windows.
@@ -169,6 +173,43 @@ fun captureScreenRoboImage( | |||
} | |||
} | |||
|
|||
@InternalRoborazziApi | |||
fun captureScreenIfMultipleWindows( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sergio-sastre
Thanks as always. I'm thinking about adding support for the AlertDialog()
Composable.
Currently, it throws an IllegalStateException
, and I would like to fix that behavior.
The basic strategy here is to use captureScreenRoboImage()
(which merges all windows into one screenshot) if there are multiple windows.
Do you have any thought on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@takahirom
Oh sorry, I‘ve just seen this and also saw that it was merged.
I think it is fine as first solution.
Getting it right with the windows is a tricky one.
Have you tried by converting the corresponding ComposeView to bitmap and capturing a bitmap from it? That would likely avoid the IllegalStateException. However, I am not sure whether we could use PixelCopy to draw the bitmap with elevation.
what I mean is to use sth like this composeView.drawToBitmap().captureRoboImage()
maybe worth giving it a try?
close #554