cashapp / paparazzi

Render your Android screens without a physical device or emulator
https://cashapp.github.io/paparazzi/
Apache License 2.0
2.22k stars 210 forks source link

1.3.4 lost bottom button bar with showSystemUi = true (in some edge case) #1450

Closed TWiStErRob closed 1 month ago

TWiStErRob commented 1 month ago

Description When upgrading from 1.3.3 to 1.3.4 tests with showSystemUi failed because of missing bottom buttons (along with some other slight rendering changes probably due to layoutlib internals). It's driving me crazy because the top bar is there!

The only thing that's changed are Paparazzi and compileSdk 34 for Paparazzi tests. I diffed classes Paparazzi 1.3.3 vs PaparazziSdk 1.3.4 and they're essentially the same, so no clue there.

I'm using some hackery (UsableActivityHack.kt) actually run an Activity (launch activity, start it, detach content view, and snapshot it). I'm looking for an idea where I could look to re-show the bottom nav, because I'm lost why it would disappear when it was working fine since Paparazzi 1.0.0 in 2022.

Steps to Reproduce I tried reproducing in a small sample project without the hacks, but it "just works". Not expecting you to repro, just listing for reference. 1. Clone https://github.com/TWiStErRob/net.twisterrob.sun 2. Check out f10917f38ff5d056b648d29d0908329209fe8628 (last 1.3.3 version) 3. `gradlew :feature:configuration:recordPaparazziDebug -Pnet.twisterrob.build.screenshot-tests=true` 4. Check out 7e0de878120d506350b298dfc50845e67f0adb24 (1.3.4 upgrade) 5. Make `useDeviceResolution = false` (or delete) in `component/paparazzi/src/main/java/net/twisterrob/sun/test/screenshots/PaparazziFactory.kt` > `activityPaparazzi()` so the delta looks reasonable (as screenshot below). 6. `gradlew :feature:configuration:verifyPaparazziDebug -Pnet.twisterrob.build.screenshot-tests=true`

Expected behavior Buttons keep showing as part of showSystemUi as before.

Additional information:

Screenshots delta-net twisterrob sun android_SunAngleWidgetConfigurationScreenshotTest_testValidSettings

geoff-powell commented 1 month ago

hmm, when looking at the 1.3.4 snapshot, I noticed that the navigation icons are being drawn, just in a Light theme. I'm going to take a look at your branch and make sure the default theme you are using to render the snapshot. It may have to do with a Theme change potential with the default theme.

Sample of Material.Light.NoAppBar theme in layout lib Screenshot 2024-05-28 at 3 27 33 PM

Update

When looking in your repo is looks like your theme is using AppCompat.Light as a base theme. So that is actually the expected result. image

TWiStErRob commented 1 month ago

Ah, cool! Thanks for looking. I'm on my phone and I see the white triangle, circle and square if I zoom in. I guess my PC might have wrong contrast setup, will double-check.

Some thoughts: why was it "working" before? Shouldn't the black bar be part of the light theme if there's a white "button" color? Note: on my phone, in light theme the bottom bar is light gray, and the buttons are gray (not white!). Also noticed the top bar not being light. These are just thoughts without investigating, but something still feels fishy.

geoff-powell commented 1 month ago

Agreed, I don't think it makes sense to change the snapshots. Specially going from Hedgehog version of LayoutLib to Iguana. There were some other updates to material and compose versions which might have to do with that change. Happy to take a quick look there. I know when we did the Iguana PR, the system ui color did change.

Otherwise, I don't know if this is an issue with Paparazzi as it is reflecting LayoutLib's output in Android Studio.

geoff-powell commented 1 month ago

Confirmed that when opening 1.3.3 version of Paparazzi in Android Studio Hedgehog, the System UI is rendered like your previous snapshot suggests. image

The version of AppCompat 1.6.1) seems to be the same across release versions 1.3.3 and 1.3.4 of Paparazzi.

Looks like Material artifact was updated from 1.5.4 -> 1.6.7 in the 1.3.4 Paparazzi.

Unfortunately I think this is a change in layout lib and the only input I have is that snapshots should be updated. It might be worth logging an issue for Android Studio.

geoff-powell commented 1 month ago

Also your comment Note: on my phone, in light theme the bottom bar is light gray, and the buttons are gray (not white!). Also noticed the top bar not being light. seems like that is expected and could be the bug with layoutlib