Repository navigation
drawing: do not fail on an arc whose scaled-up radii look too small after rounding - #2163
Merged
Merged
Conversation
andersonhc
reviewed
Nov 11, 2026
Collaborator
|
The new regression test is failing because one coordinate rounds slightly differently across environments (287.8128 instead of 287.8127). Could we compare the numeric coordinates with a small absolute tolerance, while still checking the drawing operators exactly? That should keep the regression coverage without depending on identical floating-point results. assert actual_numbers == pytest.approx(expected_numbers, abs=1.1e-4, rel=0) |
…ndering_smooth_curves
Author
|
Thanks, done as you suggested: test_rendering_smooth_curves now compares the operators exactly and the numbers with pytest.approx(..., abs=1.1e-4, rel=0). |
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.
Five icons of Font Awesome 7.3.1, among them
brands/instagram.svg, fail with:The ring of the Instagram icon is made of two half circles,
a74.6 74.6 0 1 1 .6 149.2, whose end points are exactly a diameter apart. The path is relative, so after the earlier arcs the start point is224.30000244424667, and the radii come out a tiny bit too small to reach the end point._approximate_arc()then scales them up, as the SVG implementation notes say, and for such radii the value under the square root in the center computation is 0, the center being the midpoint. With rounding errors it is slightly negative, beyond what the existinground(..., 8)absorbs for coordinates of this size, somath.sqrt()fails.The value is now clamped at 0. All 2161 Font Awesome 7.3.1 icons load, and the Instagram icon renders as in a browser.
The new case in
svg_path_render_testsis the two rings of that icon; it fails on master. The SVG tests, black, pylint, mypy and pyright pass