cppfw / svgdom

:house: SVG document object model in C++
MIT License
49 stars 17 forks source link

PathElement: Fixed issue with missing white space when appending steps to d #5

Closed JaimeIvanCervantes closed 7 years ago

JaimeIvanCervantes commented 7 years ago

This commit fixes the following problem: on the function attribsToStream() of PathElement, whenever the chars of a new step, with a new type, are appended to attribute d, there is a missing space.

Here's an example of the incorrect string produced: <path d="M0,0L0,300l300,300"/>

And here's how it should look like: <path d="M0,0 L0,300 l300,300"/>

With this fix, a space is added whenever there is a new step type, except for the first iteration of the loop.

igagis commented 7 years ago

@JaimeIvanCervantes according to svg spec: https://www.w3.org/TR/SVG/paths.html#PathDataGeneralInformation those spaces are not mandatory. Why do you need those spaces? Are you not able to open such SVG without spaces with some software?

JaimeIvanCervantes commented 7 years ago

I added them to be more readable, and also because almost all the examples have spaces, but it's your call. Maybe it could also be an option.

igagis commented 7 years ago

I don't mind to make it more readable, it is not critical for me as this functionality of writing SVG to XML is currently only used for tests. So, if you correct the tests also so that they would all pass I'll merge the PR. What you need to do is to adjust the etalon samples against which the results of saving SVGs compared. I.e. add those spaces to etalon samples. This can be done using the test application, just check out its command line arguments and you'll get the clue about how to re-generate the samples.

igagis commented 7 years ago

@JaimeIvanCervantes please update the PR to latest changes from master branch and correct the test cases, so that all builds would pass.

JaimeIvanCervantes commented 7 years ago

I updated the .cmp files. Waiting for the test to pass.