tests/image: comments: specs only
This commit is contained in:
1 parent
e306d5c1d7
commit
a80299dce0
27 files changed
+32
-199
No files matched your search
@@ -1,6 +1,4 @@
|
||||
-- image/qoi tests: Pillow-written QOI files (RGB / RGBA, noise / gradients / runs / small deltas, 1x1 to 500x1)
|
||||
-- decode to Pillow's pixels; our encoder writes the same bytes as Pillow for the same pixels and round-trips exactly;
|
||||
-- native rgb8 output, the colour space tag, errors, and the fuzz no-throw pass. Fixtures: tools/fixtures/qoi.py.
|
||||
-- image/qoi tests: decodes and encoder bytes against Pillow (tools/fixtures/qoi.py).
|
||||
local T = require("@tests/T")
|
||||
local Qoi = require("@rosetta/image/qoi")
|
||||
local Bytes = require("@rosetta/core/Bytes")
|
||||
@@ -20,7 +18,6 @@ for _, c in Fx do
|
||||
t:check(img, c.name .. ": " .. tostring(err))
|
||||
t:check(img.width == c.width and img.height == c.height and img.format == "rgba8", c.name .. ": size")
|
||||
t:eq(Crc32.of(img.pixels), c.crc, c.name .. ": pixels against Pillow")
|
||||
-- encode the source pixels: the same bytes as Pillow's writer
|
||||
local src = Types.Image.new(c.width, c.height, if c.channels == 4 then "rgba8" else "rgb8")
|
||||
src.pixels = buffer.fromstring(c.pixels)
|
||||
local enc = Qoi.encode(src, { channels = c.channels, linear = string.byte(c.data, 14) == 1 }) :: buffer -- Pillow tags its files linear
|
||||
@@ -29,7 +26,6 @@ for _, c in Fx do
|
||||
end
|
||||
local back = Qoi.decode(Bytes.reader(enc))
|
||||
t:eq(Crc32.of(back.pixels), c.crc, c.name .. ": our encoding round-trips")
|
||||
-- native rgb8
|
||||
if c.channels == 3 then
|
||||
local n = Qoi.decode(Bytes.reader(buffer.fromstring(c.data)), { native = true })
|
||||
t:check(n.format == "rgb8" and buffer.tostring(n.pixels) == c.pixels, c.name .. ": native rgb8")
|
||||
@@ -38,7 +34,6 @@ end
|
||||
t:eq(same, #Fx, "byte-identical to Pillow's encoder")
|
||||
t:note("%d Pillow files decode; %d of our encodings are byte-identical to Pillow's", #Fx, same)
|
||||
|
||||
-- round trips of random images, a sub-range reader, colour space, errors
|
||||
do
|
||||
local rand = T.rng(5)
|
||||
for _, s in { { 1, 1 }, { 70, 3 }, { 33, 33 } } do
|
||||
|
||||
Reference in new issue
Block a user