Repository navigation
fix(icons): repair the attribute rewrite that stopped every icon rendering - #439
Merged
Merged
Conversation
…ering set_root_attribute kept the closing quote of the value it replaced and appended another, so an Iconify source carrying width="1em" came out as width="84"" and did not parse. Every icon has rendered nothing since #390, announced only by a warning on stderr under a zero exit code. The existing tests missed it because they assert contains("width=\"84\"") on the output, which is true of the broken string too. The new unit test parses the rewritten SVG with usvg instead, and the render tests go through a real scenario to pixel assertions -- 0 coloured pixels on the revert. render --frame did not preload at all, so an unresolvable icon warned and exited 0 there while still, sheet and the encoders exited 1. It now goes through preload_scenario_assets like the other single-frame paths. 674 files in a real cache still carry the old {slug}-{colour}-{w}x{h} name. They are recoloured copies, not sources, but the colour is in the filename, so the substitution is reversible: on a source miss the cache is scanned for one and currentColor is restored from it rather than refetching. That is what lets an offline render work from a cache filled before the rework. Parsing is anchored at the right of the name, since an icon's own name can contain a dash.
12 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #425.
set_root_attributekept the closing quote of the value it replaced and appendedanother. An Iconify source carrying
width="1em"came out aswidth="84"", whichdoes not parse, so every icon has rendered nothing since #390 — announced only by
a warning on stderr under a zero exit code.
The existing tests missed it because they assert
contains("width=\"84\""), whichis true of the broken string too. The new unit test parses the rewritten SVG with
usvg instead, and two render tests go through a real scenario to pixel assertions.
Reverting the one-character fix reports
the icon painted 0 coloured pixels.render --framedid not preload at all, so an unresolvable icon warned and exited0 there while
still,sheetand the encoders exited 1. It now goes throughpreload_scenario_assetslike the other single-frame paths — verified at 1 and 1.674 files in a real cache still carry the old
{slug}-{colour}-{w}x{h}name. Theyare recoloured copies rather than sources, but the colour is in the filename, so
the substitution is reversible: on a source miss the cache is scanned for one and
currentColoris restored from it instead of refetching. That is what lets anoffline render work from a cache filled before the rework. Parsing is anchored at
the right of the name, since an icon's own name can contain a dash
(
lucide_arrow-down-8b5cf6-176x176.svg).The fourth item — reviving
validate --offline/rustmotion icons prefetch— isnot here. #320 has since landed
--allow-remote-fonts, so an offline render nowhas a gate for fonts and none for icons, and the shape of the icon one should
follow that decision rather than precede it. Worth its own issue.
cargo fmt --all --checkclean ·cargo clippy --workspace --all-targets --features rustmotion/studio -D warningsclean ·cargo test --workspace1822 passed.