cashapp / paparazzi

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

Pseudolocalization tests throwing exception when recording a custom Android View #1276

Open sergio-sastre opened 10 months ago

sergio-sastre commented 10 months ago

Description When running a test with locale = "en-rXA", in an Android View containing a custom View, the test throws app.cash.paparazzi.internal.PaparazziLogger$MultipleFailuresException: There were 3 errors:

  1. java.lang.IllegalArgumentException: Float format error when parsing: Ḿ23,7Ĥ9Ç7.9,7,7,7.9,7,9[ is not a valid verb. Failure occurred at position 0 of path: [Ḿ23,7Ĥ9Ç7.9,7,7,7.9,7,9V14ç0,1.1,0.9,2,2,2ĥ14ç1.1,0,2-0.9,2-2ν9Ç25,7.9,24.1,7,23,7ž Ḿ23,23Ĥ9ν9ĥ14ν23ž one two three four five six seven eight nine ten eleven]...

  2. android.content.res.Resources$NotFoundException: Could not find drawable resource matching value 0x7F0800B1 (resolved name: mtrl_ic_checkbox_checked) in current configuration...

  3. android.view.InflateException: Binary XML file line # 20: Error inflating class com.example.road.to.effective.snapshot.testing.recyclerviewscreen.ui.views.LanguageRadioButton...

Steps to Reproduce The example to reproduce the bug can be found here Repo: https://github.com/sergio-sastre/Android-screenshot-testing-playground Branch: bug/pseudolocale_exception Module: recyclerviewscreen:paparazzi The test class is this one

Expected behavior The test would execute normally as it does with non-pseudolocales

Additional information:

And...

kevinzheng-ap commented 7 months ago

@sergio-sastre The reason is today Paparazzi does not support translatable attribute for string resource, as per comment here.

In your case, it is using <string name="mtrl_checkbox_button_path_unchecked" translatable="false">M23,7H9C7.9,7,7,7.9,7,9v14c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V9C25,7.9,24.1,7,23,7z M23,23H9V9h14V23z</string> from Material Components library. The actual path actually gets pseudo localised, which makes it a invalid format.

cc @jrodbx