nikolaydubina / treemap

🍬 Pretty Treemaps
153 stars 2 forks source link

Escale illegal XML characters #23

Closed mlange-42 closed 1 year ago

mlange-42 commented 1 year ago

Escapes illegal XML characters.

Decided to do it in svg.go rather than in the UIText construction, as the issue is specific for SVG rendering.

Not sure how to add useful unit tests for this.

Fixes #20

mlange-42 commented 1 year ago

nice!

can you add test file that was breaking for you?

ideally with all the 5 characters there were breaking

we need this for integration test

Not sure how to test this. treemap worked fine, just the browser or whatever you use to display the SVG complains about/crashes with illegal characters or XML syntax error.

nikolaydubina commented 1 year ago

to test this just need to have /testdata/ok_strange_chars_path.csv that contains those chars. then we build and try to render those. then manual verification and include into repo.

we can't really "automate" (actually can but it is overkill for this project) whether SVG looks ok. so manual verification

mlange-42 commented 1 year ago

Added a test file that uses all the critical characters.

Tests showed that setting LazyQuotes in the CSV reader was additionally required to allow double quotes.

codecov[bot] commented 1 year ago

Codecov Report

Base: 52.83% // Head: 52.39% // Decreases project coverage by -0.43% :warning:

Coverage data is based on head (c9a43ad) compared to base (e5ec8a1). Patch coverage: 50.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #23 +/- ## ========================================== - Coverage 52.83% 52.39% -0.44% ========================================== Files 7 7 Lines 583 584 +1 ========================================== - Hits 308 306 -2 - Misses 272 274 +2 - Partials 3 4 +1 ``` | [Impacted Files](https://codecov.io/gh/nikolaydubina/treemap/pull/23?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Nikolay+Dubina) | Coverage Δ | | |---|---|---| | [render/svg.go](https://codecov.io/gh/nikolaydubina/treemap/pull/23/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Nikolay+Dubina#diff-cmVuZGVyL3N2Zy5nbw==) | `0.00% <0.00%> (ø)` | | | [parser/csv\_tree\_parser.go](https://codecov.io/gh/nikolaydubina/treemap/pull/23/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Nikolay+Dubina#diff-cGFyc2VyL2Nzdl90cmVlX3BhcnNlci5nbw==) | `84.61% <100.00%> (-2.77%)` | :arrow_down: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Nikolay+Dubina). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Nikolay+Dubina)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.