2022-01-07 13:50:43 +00:00
|
|
|
import pixie/fileformats/ppm
|
|
|
|
|
|
|
|
block:
|
|
|
|
for format in @["p3", "p6"]:
|
2022-06-09 00:53:22 +00:00
|
|
|
let
|
|
|
|
path = "tests/fileformats/ppm/feep." & $format & ".master.ppm"
|
|
|
|
image = decodePpm(readFile(path))
|
|
|
|
dimensions = decodePpmDimensions(readFile(path))
|
2022-01-07 13:50:43 +00:00
|
|
|
writeFile("tests/fileformats/ppm/feep." & $format & ".ppm", encodePpm(image))
|
2022-06-09 00:53:22 +00:00
|
|
|
doAssert image.width == dimensions.width
|
|
|
|
doAssert image.height == dimensions.height
|
2022-01-10 13:23:48 +00:00
|
|
|
|
2022-06-09 00:53:22 +00:00
|
|
|
block:
|
|
|
|
let
|
|
|
|
path = "tests/fileformats/ppm/feep.p3.hidepth.master.ppm"
|
|
|
|
image = decodePpm(readFile(path))
|
|
|
|
dimensions = decodePpmDimensions(readFile(path))
|
2022-01-10 13:23:48 +00:00
|
|
|
writeFile("tests/fileformats/ppm/feep.p3.hidepth.ppm", encodePpm(image))
|
2022-06-09 00:53:22 +00:00
|
|
|
doAssert image.width == dimensions.width
|
|
|
|
doAssert image.height == dimensions.height
|
2022-01-11 10:51:54 +00:00
|
|
|
|
|
|
|
# produced output should be identical to P6 master
|
|
|
|
let p6Master = readFile("tests/fileformats/ppm/feep.p6.master.ppm")
|
|
|
|
for image in @["p3", "p6", "p3.hidepth"]:
|
|
|
|
doAssert readFile("tests/fileformats/ppm/feep." & $image & ".ppm") == p6Master
|