Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing infrastructure should be improved #43

Open
jni opened this issue Jun 19, 2024 · 1 comment
Open

Testing infrastructure should be improved #43

jni opened this issue Jun 19, 2024 · 1 comment

Comments

@jni
Copy link
Member

jni commented Jun 19, 2024

Currently our testing only accounts for regressions against an existing saved svg. This is very primitive and subject to churn when we change the svg output e.g. to add transforms as in #40. We could add a test-time dependency on an svg processing library such as svgelements to test invariants between current output and reference svgs, rather than testing exact text equality.

See discussion here.

@jni
Copy link
Member Author

jni commented Jun 19, 2024

This now-archived tool probably holds relevant lessons: https://github.com/jrsmith3/diffsvg

I like this bit in their readme about Inkscape-produced svgs:

Since the (oversimplified) input into this tool is SVG that comes out of inkscape, every element/group/layer/etc. will have a unique ID. The task is to parse the XML, match the ids of the elements/groups/layer/yaddayadda in A.svg to the things in B.svg and see if there is a difference. For example, perhaps there is a new layer in B.svg. Maybe some elements in A.svg were grouped and moved to a new layer in B.svg. Perhaps the color or size of an element changes from A.svg to B.svg. The unique ids are the key to determining the differences.

We could do the same thing here, e.g. the g group for a layer (#42) gets the layer name as the id, and elements within that layer get layer_name-index.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant