-
Notifications
You must be signed in to change notification settings - Fork 17
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
Captured screenshots do not show elevation of elements #58
Comments
Elevation is most likely drawn outside your view bounds and that's the reason why you would not see the elevation. |
@sebastienrouif I am not following that logic. The UI is rendered in the emulator, and I can visually see the elevation there when placing a breakpoint prior to the screenshot. It is not outside the view bounds of the device. Card itself is also a container if I am not mistaken, which is within a lazy column that represents the main content of the screen. There are also other elements on the screen within the same bounds that display with no issue. |
I assumed you were taking a screenshot of that view only, are you taking a screenshot of the whole Activity? |
That was my assumption based on the description, as well. Can you make a simple repro that would allow you to share a screenshot of the issue (perhaps a screenshot of the emulator in that state alongside the recorded screenshot)? |
We are using an activity rule that loads a full fragment displaying a composable screen. It is not a component level screen shot. Yes I said "element" but that was not meant to be one single thing. It is just a piece of the overall screen. |
That's fine, but what do you pass to the Dropshots rule to assert the
snapshot? Can you share some code showing how you use dropshots, or example
screenshots, or something?
…On Wed, Nov 22, 2023, 17:40 Andy Delso ***@***.***> wrote:
We are using an activity rule that loads a full fragment displaying a
composable screen. It is not a component level screen shot.
—
Reply to this email directly, view it on GitHub
<#58 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJ4S3QZC6YVOQELL2UR7GTYF2EP7AVCNFSM6AAAAAA7WLDJZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRTGYZTENRRHE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Here is a scenario we setup with the way we are invoking dropshots. We have a way to mock the calls to our api prior to the snapshot being shown (localApi), and also an extra rule to handle encrypted shared preferences. Neither should directly affect if something is elevated though.
|
The UI is something like this:
AnnoucementCard is in its simplest:
|
Thanks for sharing. If you set a breakpoint on the Dropshots doesn't alter the way anything is rendered, it just renders the window and records that, so I'm curious if there's something with the test setup (like the theme setting) that's preventing the elevation from being drawn. |
As stated in the second comment: "The UI is rendered in the emulator, and I can visually see the elevation there when placing a breakpoint prior to the screenshot". Your thought process is kinda where what we were thinking as well. Maybe something with the emulator setup for hardware acceleration or something would cause it. However, that didn't fully make sense as it was rendered to the emulator prior to the screenshot. It is so weird 😆 |
Hmm, that's weird. Internally, Dropshots just uses the AndroidX test screenshot class to take the screenshot. If you run this in the breakpoint evaluate expression dialog do you get the elevation? If not, I'd check the docs for that to see if they mention anything about hardware acceleration. I think I recall seeing some special handling in there for non-accepleratre surfaces, but am on mobile so can't look it up right now.
|
Much the same here. Getting ready for the holiday. I'll check again on Friday. |
@rharter when I add that expression I get the following: At that point the emulator shows the elevation, clicking "view bitmap" next to the expression shows no elevation. |
Also to note, the emulator we are all using has Emulated Performance > Graphics set to "Automatic". |
@rharter I was wondering if the above gave you any other ideas? |
@ddaypunk I explained this in more detail in this workshop at Droidcon, from min 18:35. I did it with Shot, but the same applies to Dropshots and other libs. |
We are running into an issue running tests that do not seem to take element elevation into account when the shot is taken. We can visually see the elevation (example on a Compose Card element) on the running emulator, but not in the resulting screenshot.
We were wondering if anyone has run into this same issue and knows of a work around? Alternately, is there a possible issue with the emulator we setup (needs hardware acceleration or something)?
I would share screenshots of the screenshots, but it is an internal only build and I can't share at this time.
The text was updated successfully, but these errors were encountered: