2022-05-21 23:27:38 +00:00
|
|
|
import pixie, pixie/fileformats/qoi
|
2022-01-01 22:50:23 +00:00
|
|
|
|
|
|
|
const tests = ["testcard", "testcard_rgba"]
|
|
|
|
|
|
|
|
for name in tests:
|
2022-01-03 23:41:36 +00:00
|
|
|
let
|
2022-06-09 00:53:22 +00:00
|
|
|
path = "tests/fileformats/qoi/" & name & ".qoi"
|
|
|
|
input = readImage(path)
|
2022-05-21 23:27:38 +00:00
|
|
|
control = readImage("tests/fileformats/qoi/" & name & ".png")
|
2022-06-09 00:53:22 +00:00
|
|
|
dimensions = decodeQoiDimensions(readFile(path))
|
2022-01-03 23:41:36 +00:00
|
|
|
doAssert input.data == control.data, "input mismatch of " & name
|
2022-06-09 00:53:22 +00:00
|
|
|
doAssert input.width == dimensions.width
|
|
|
|
doAssert input.height == dimensions.height
|
2022-01-04 01:14:48 +00:00
|
|
|
discard encodeQoi(control)
|
2022-01-03 23:41:36 +00:00
|
|
|
|
2022-01-01 22:50:23 +00:00
|
|
|
for name in tests:
|
2022-01-03 23:41:36 +00:00
|
|
|
let
|
2022-06-09 00:53:22 +00:00
|
|
|
path = "tests/fileformats/qoi/" & name & ".qoi"
|
|
|
|
input = decodeQoi(readFile(path))
|
2022-05-21 23:27:38 +00:00
|
|
|
output = decodeQoi(encodeQoi(input))
|
2022-01-03 23:41:36 +00:00
|
|
|
doAssert output.data.len == input.data.len
|
|
|
|
doAssert output.data == input.data
|