2021-02-14 18:27:32 +00:00
|
|
|
import pixie, pixie/fileformats/svg, strformat
|
2020-12-04 16:17:03 +00:00
|
|
|
|
2020-12-20 00:01:14 +00:00
|
|
|
const files = [
|
2020-12-20 03:59:43 +00:00
|
|
|
"line01",
|
|
|
|
"polyline01",
|
|
|
|
"polygon01",
|
|
|
|
"rect01",
|
|
|
|
"rect02",
|
|
|
|
"circle01",
|
2020-12-20 18:17:55 +00:00
|
|
|
"ellipse01",
|
2020-12-20 00:01:14 +00:00
|
|
|
"triangle01",
|
2020-12-20 02:47:05 +00:00
|
|
|
"quad01",
|
2021-04-27 00:50:00 +00:00
|
|
|
"Ghostscript_Tiger",
|
2021-05-24 02:17:30 +00:00
|
|
|
"scale",
|
2021-05-24 03:29:59 +00:00
|
|
|
"miterlimit",
|
|
|
|
"dashes"
|
2020-12-20 00:01:14 +00:00
|
|
|
]
|
2020-12-04 20:09:08 +00:00
|
|
|
|
2020-12-20 00:01:14 +00:00
|
|
|
for file in files:
|
|
|
|
let
|
|
|
|
original = readFile(&"tests/images/svg/{file}.svg")
|
|
|
|
image = decodeSvg(original)
|
2021-02-28 07:00:05 +00:00
|
|
|
gold = readImage(&"tests/images/svg/{file}.png")
|
2020-12-20 00:01:14 +00:00
|
|
|
|
2021-02-28 07:11:53 +00:00
|
|
|
let (score, _) = diff(image, gold)
|
|
|
|
doAssert score < 1
|
2021-04-27 00:50:00 +00:00
|
|
|
image.writeFile(&"tests/images/svg/{file}.png")
|