png: tests for maxSide / reduce (every PngSuite and generated image, APNG frames, a 2048x2048 16-bit fixture), yield; paeth for 16-bit RGB rows; jpeg: opts.maxSide (scale 1..8) and opts.yield reach the codec; Deflate.zlibStream tests

This commit is contained in:
4DBug committed 2026-11-02 23:01:59 -06:00
1 parent e3e6273799
commit 64a2553c0c
8 files changed
+321 -9

No files matched your search

+18
View File
@@ -6,6 +6,7 @@ local Crc32 = require("@rosetta/core/Crc32")
local Err = require("@rosetta/core/Err")
local Types = require("@rosetta/Types")
local Cases = require("@tests/gen/apng_cases")
local R = require("@tests/image/_raster")
local t = T.suite("apng")
@@ -145,6 +146,23 @@ do
t:check(Png.composite({} :: any) == nil, "composite of a non-image")
end
do
-- reduce: every frame is box-reduced on its own; offsets are divided (rounded down)
local frames = 0
for _, c in Cases do
local full = decode(c.data)
local img, err = decode(c.data, { reduce = 2 })
t:check(img and #img.frames == #full.frames, c.name .. " reduce 2: " .. tostring(err))
for i, f in full.frames do
local g = img.frames[i]
t:check(g.x == f.x // 2 and g.y == f.y // 2 and g.delay == f.delay and g.dispose == f.dispose, c.name .. " reduce 2: frame " .. i .. " fields")
t:check(same(g.image, R.box(f.image, 2)), c.name .. " reduce 2: frame " .. i .. " pixels")
frames += 1
end
end
t:note("reduce 2: %d frames match the box reduction of the full frames", frames)
end
do
local samples = {}
for _, c in Cases do