pixie/tests/test_qoi.nim
Ryan Oldenburg 1e980aa018 f
2022-01-03 19:14:48 -06:00

18 lines
605 B
Nim

import pixie, pixie/fileformats/png, pixie/fileformats/qoi
const tests = ["testcard", "testcard_rgba"]
for name in tests:
let
input = decodeQoi(readFile("tests/fileformats/qoi/" & name & ".qoi"))
control = decodePng(readFile("tests/fileformats/qoi/" & name & ".png"))
doAssert input.data == control.data, "input mismatch of " & name
discard encodeQoi(control)
for name in tests:
let
input = decodeQoiRaw(readFile("tests/fileformats/qoi/" & name & ".qoi"))
output = decodeQoiRaw(encodeQoi(input))
doAssert output.data.len == input.data.len
doAssert output.data == input.data