This directory contains a collection of SVG files used during resvg regression testing.
Each test has a type-name-index.svg
format.
type
can be either ana
(attribute) or ane
(element)name
corresponds to an actual SVG attribute or elementindex
is just a serial number
We are using SVG files with a fixed, 200x200 viewbox for all tests.
Here is a test file template:
<svg id="svg1" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
<title>My new test</title>
<!-- replace with an actual SVG data -->
<!-- image frame -->
<rect id="frame" x="1" y="1" width="198" height="198" fill="none" stroke="black"/>
</svg>
General requirements:
- Each test must test only a single issue.
- Each element must have an
id
attribute. - The
title
value must be unique and shorter than 60 characters.
Newlines are not allowed. - Each line in an XML file should be less than 100 characters.
- No trailing spaces.
- A single trailing newline.
- UTF-8 only.
You could use the check.py
script to automatically check those requirements.
After the SVG test is finished, you should render it using resvg:
cargo run --release -- \
--width 300 \
--skip-system-fonts \
--use-fonts-dir 'tests/fonts' \
--font-family 'Noto Sans' \
--serif-family 'Noto Serif' \
--sans-serif-family 'Noto Sans' \
--cursive-family 'Yellowtail' \
--fantasy-family 'Sedgwick Ave Display' \
--monospace-family 'Noto Mono' \
in.svg out.png
(we are using 300px width to test scaling)
After that, you should optimize the resulting PNG using oxipng:
cargo install oxipng
oxipng -o 6 -Z out.png
And then place it into the png
dir.
MIT
The library itself is under the MPL2.0, but tests are under MIT, so you can do whatever you want with them.