Repository navigation
Add screenshot tests for Compose-based HTML -> annotated strings - #7441
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new screenshot test’s KDoc overstates coverage (missing the AbsoluteSizeSpan branch) and the preview setup deviates from established screenshot-test conventions in this module.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a new screenshot-test suite in :app to visually validate the HTML → AnnotatedString conversion used by Compose screens when rendering Home Assistant templates.
Changes:
- Introduces
HtmlTextScreenshotTestwith previews covering common markup cases (bold/italic/underline/size/color/line breaks). - Adds combined-markup scenarios to catch span-interactions in the rendered output.
File summaries
| File | Description |
|---|---|
| app/src/screenshotTest/kotlin/io/homeassistant/companion/android/util/compose/HtmlTextScreenshotTest.kt | Adds screenshot previews to exercise parseHtml output across typical HTML span combinations. |
Review details
- Files reviewed: 1/10 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| /** | ||
| * Tests for all possible spans supported by [parseHtml] with: | ||
| * - no markup (verify nothing changes) | ||
| * - each markup separate | ||
| * - markup combined | ||
| */ |
There was a problem hiding this comment.
The original doc is correct, it is what is possible by using parseHtml. It just will never reach that branch as it isn't possible.
We should maybe drop AbsoluteSizeSpan completely but that is out of scope for this PR in my opinion.
Summary
Adds screenshot tests for the function that was added in #7288 to convert HTML strings (templates) to an annotated string for display in Compose.
Adresses the second paragraph of my last review comment.
Note that
Html.fromHtmlnever creates absolute size spans, so this branch isn't in screenshots. See the source code, the only usage of AbsoluteSizeSpan is when converting a string that already has one to HTML.Checklist
Select exactly one option that describes AI usage in this contribution:
Screenshots
See changed files
Link to pull request in documentation repositories
n/a
Any other notes