Repository navigation
fix(render): name the QR error-correction level - #651
Open
LKSNDRTMLKV wants to merge 1 commit into
Open
LKSNDRTMLKV wants to merge 1 commit into
LKSNDRTMLKV wants to merge 1 commit into
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 39 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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 #474.
Both carrier renderers called
QrCode::new, which inqrcode0.14 encodes at error-correction level M. Nobody chose M here; it was the library default, so a dependency update could have changed it with nothing noticing. The quiet zone had the same history untilQR_QUIET_ZONE_MODULESgave it one home.What changes
QR_ERROR_CORRECTION, set toEcLevel::M, sits besideQR_QUIET_ZONE_MODULESincrates/dpp-render/src/carrier.rsand is re-exported the same way. Its doc comment explains the choice: M survives roughly 15% of the symbol's codewords being damaged, which suits a URL on a clean label.QrCode::with_error_correction_level. They are the passport page's SVG (build_qr_svg) and the resolver's PNG route (qr_png). Neither callsQrCode::newany more.carrier_uriand the publish-side carrier URL builder, and both now say QR.Whether a label that can be scuffed, such as a battery or a care label, needs Q or H, and whether a second symbology is needed, both wait for EN 18220 (#434).
Tests
Each renderer has a geometry test, in the same style as the quiet-zone tests:
the_svg_symbol_is_drawn_at_the_level_m_width(crates/dpp-render/src/page.rs);the_png_symbol_is_drawn_at_the_level_m_width(crates/dpp-resolver/src/handlers/resolve_qr.rs).Both use a 77-byte GS1 Digital Link carrying AI 10 and 21. At L, M and Q its symbol is version 4, 5 and 6 respectively, so each level draws a different width. Each test first asserts that premise and then checks that the rendered size frames M's width. The existing quiet-zone test builds its expected symbol through the constant.
Checked
just checkgreen on this branch: 1931 tests passed, 3 skipped, audit included.dpp-render65 tests passed,dpp-resolver174.