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,7 +1,4 @@
|
||||
-- image/tga tests: Pillow- and ImageMagick-written TGAs (RGB / RGBA / grey / grey + alpha / palette, raw and RLE, both
|
||||
-- origins) and hand-written ones (15 / 16-bit pixels and colour maps, first index, right-to-left, RLE across rows, an
|
||||
-- image ID) against the reference RGBA decodes; our encoder (raw / RLE, origins, 24 / 32-bit / grey) round-trips;
|
||||
-- sniffing stays low without a footer; errors; the fuzz no-throw pass. Fixtures: tools/fixtures/tga.py.
|
||||
-- image/tga tests against Pillow's and ImageMagick's decodes (tools/fixtures/tga.py).
|
||||
local T = require("@tests/T")
|
||||
local Tga = require("@rosetta/image/tga")
|
||||
local Bytes = require("@rosetta/core/Bytes")
|
||||
@@ -31,7 +28,6 @@ for _, c in Fx do
|
||||
end
|
||||
t:check(worst == 0, string.format("%s: differs from the reference by %d at byte %d", c.name, worst, at))
|
||||
t:check(not img.meta.truncated, c.name .. ": not truncated")
|
||||
-- round trips through our encoder
|
||||
for _, rle in { false, true } do
|
||||
for _, origin in { "bottom-left", "top-left" } do
|
||||
local enc = Tga.encode(img, { rle = rle, origin = origin }) :: buffer
|
||||
@@ -61,7 +57,6 @@ do
|
||||
t:eq(Tga.sniff(Bytes.reader(Tga.encode(p) :: buffer)), 0.9, "sniff with the footer")
|
||||
t:eq(Tga.sniff(Bytes.reader(buffer.fromstring("\0\0\1\0\1\0\16\16\0\0\1\0\32\0\0\0\0\0\0\0\0\0"))), 0, "an ICO header is not a TGA")
|
||||
t:eq(Tga.sniff(Bytes.reader(buffer.fromstring("\137PNG\r\n\26\n\0\0\0\13IHDR\0\0\0\0\0\0"))), 0, "a PNG is not a TGA")
|
||||
-- encoder choices
|
||||
local img = Types.Image.new(3, 2)
|
||||
buffer.fill(img.pixels, 0, 255, 24)
|
||||
t:eq(buffer.readu8(Tga.encode(img) :: buffer, 16), 24, "opaque rgba8 -> 24-bit")
|
||||
|
||||
Reference in new issue
Block a user