2021-02-14 18:27:32 +00:00
|
|
|
import pixie, strformat, svg_cairo
|
2021-01-26 00:47:05 +00:00
|
|
|
|
|
|
|
const files = [
|
|
|
|
"line01",
|
|
|
|
"polyline01",
|
|
|
|
"polygon01",
|
|
|
|
"rect01",
|
|
|
|
"rect02",
|
|
|
|
"circle01",
|
|
|
|
"ellipse01",
|
|
|
|
"triangle01",
|
|
|
|
"quad01",
|
2021-11-26 00:02:47 +00:00
|
|
|
"Ghostscript_Tiger",
|
|
|
|
"scale",
|
|
|
|
"miterlimit",
|
|
|
|
"dashes"
|
2021-01-26 00:47:05 +00:00
|
|
|
]
|
|
|
|
|
2021-11-26 00:02:47 +00:00
|
|
|
proc doDiff(rendered: Image, name: string) =
|
|
|
|
rendered.writeFile(&"tests/fileformats/svg/rendered/{name}.png")
|
|
|
|
let
|
|
|
|
master = readImage(&"tests/fileformats/svg/masters/{name}.png")
|
|
|
|
(diffScore, diffImage) = diff(master, rendered)
|
|
|
|
echo &"{name} score: {diffScore}"
|
|
|
|
diffImage.writeFile(&"tests/fileformats/svg/diffs/{name}.png")
|
|
|
|
|
2021-01-26 00:47:05 +00:00
|
|
|
for file in files:
|
2021-11-26 00:02:47 +00:00
|
|
|
doDiff(decodeSvg(readFile(&"tests/fileformats/svg/{file}.svg")), file)
|