paparazzi icon indicating copy to clipboard operation
paparazzi copied to clipboard

HTML text resources are partially skipped

Open TWiStErRob opened this issue 4 years ago • 4 comments

Version: 0.8.0

Android Studio preview emulator paparazziRecord

Problem of note: on paparazziRecord snapshot the text is not bold and the rest of the text is missing.

<string name="warning_no_location"><b>The widget needs to know where you are</b>. Please adjust your Location Settings by tapping here, then wait a moment.</string>

TWiStErRob avatar Nov 09 '21 22:11 TWiStErRob

For reference https://github.com/TWiStErRob/net.twisterrob.sun/tree/bcbd0a53129742904ea74294fb55a871db01f4e0 will give us this state. Execute

gradlew :feature:configuration:recordPaparazziDebug -Pnet.twisterrob.build.screenshot-tests=true

TWiStErRob avatar Nov 09 '21 22:11 TWiStErRob

I installed the last few stable versions of Android Studio and found out that html styles in string resources were not supported until Android Studio 4.1.

4.0.2 (left) vs 4.1 (right) Screen Shot 2021-11-21 at 9 03 04 PMScreen Shot 2021-11-21 at 9 04 56 PM

Here are the relevant commits to the studio-4.1 tagline:

  • https://android.googlesource.com/platform/frameworks/layoutlib/+/eab564d763c4d33c8e09f5d3837f19845355b063%5E%21/#F0
  • https://android.googlesource.com/platform/frameworks/layoutlib/+/27506a56be0fd61dff28da50633b13f8cd630693%5E%21/#F0
  • https://android.googlesource.com/platform/frameworks/layoutlib/+/dc9e3746f8950c671f97a0561cfd632b3dbeed63%5E%21/#F0

Unfortunately, while Android Studio/LayoutLib 4.1 renders correctly, as of Paparazzi 0.9.0, this is still broken. Why?

Looks like it has something to do with how the XML parser is reading the strings.

Screen Shot 2021-11-23 at 12 12 00 PMScreen Shot 2021-11-23 at 12 11 42 PM

jrodbx avatar Nov 23 '21 17:11 jrodbx

Repro branch: https://github.com/cashapp/paparazzi/compare/jrod/2021-11-22/test-html-string-issue?expand=1

jrodbx avatar Nov 23 '21 17:11 jrodbx

Wonder if slapping a CDATA around it would "fix" this, or show the <b> literally.

TWiStErRob avatar Nov 23 '21 17:11 TWiStErRob

Partially fixed in https://issuetracker.google.com/issues/266681481 and https://issuetracker.google.com/issues/262773698.

Still remaining on https://issuetracker.google.com/issues/288441176.

jrodbx avatar Sep 28 '23 07:09 jrodbx

This was fixed in the bump to Hedgehog.

See:

  • https://issuetracker.google.com/issues/288441176
  • https://github.com/cashapp/paparazzi/pull/1227

jrodbx avatar Jan 22 '24 13:01 jrodbx

@jrodbx your last comment on https://issuetracker.google.com/issues/288441176 was that this is not fixed, did things change since then?

TWiStErRob avatar Jan 22 '24 19:01 TWiStErRob