Skip to content

Correctness

Noah Baldwin edited this page Apr 27, 2025 · 13 revisions

Maintaining correctness of SVG documents is important in ensuring OXVG is safe to use for a broad variety of use-cases. We offer two presets for safely optimizing SVGs

  • default: Is similar to SVGO's defaults and is safe to use for most SVGs using well-supported features
  • safe: Is the same as default, but has additional prechecks similar to svgcleaner

Until we reach stability, please be cautious in using OXVG for optimising SVGs. You may use our scripts in packages/correctness to assess the number of faulty documents produced by oxvg for a given library of SVGs.

Consider the following comparisons, as of April 27 2025

w3c test suite

Tool Broken Files (#) Broken Files (%)
OXVG (default) 0 0.00%
OXVG (safe) 0 0.00%
OXVG (none)* 0 0.00%
SVGO 15 1.32%
svgcleaner 3 0.26%

oxygen icons (5092 files)

Tool Broken Files (#) Broken Files (%)
OXVG (default) 0 0.00%
OXVG (safe) 0 0.00%
OXVG (none)* 0 0.00%
SVGO 59 1.16%
svgcleaner 0 0.00%

*This indicates issues solely in parsing/serializing, no additional processing is run

How to run tests

Follow the instructions in the readme of packages/correctness/. In that directory you can set up the optimised files with the following command

cargo run optimise -r -. -o optimised/w3c w3c/svg

Some of the w3c test have issues with the testing renderer and are manually checked for the cause. The following are some reasons behind why the w3c tests fail. In these cases, what may show as a fail in the testing script is recorded as a pass in the table above.

Clone this wiki locally