add some more gifload tests
This commit is contained in:
parent
b2cfe6a0a0
commit
0054c7dafa
@ -811,25 +811,33 @@ class TestForeign:
|
|||||||
self.file_loader("gifload", GIF_FILE, gif_valid)
|
self.file_loader("gifload", GIF_FILE, gif_valid)
|
||||||
self.buffer_loader("gifload_buffer", GIF_FILE, gif_valid)
|
self.buffer_loader("gifload_buffer", GIF_FILE, gif_valid)
|
||||||
|
|
||||||
# 'n' param added in 8.5
|
# test metadata
|
||||||
if pyvips.at_least_libvips(8, 5):
|
x2 = pyvips.Image.new_from_file(GIF_ANIM_FILE, n=-1)
|
||||||
x1 = pyvips.Image.new_from_file(GIF_ANIM_FILE)
|
# our test gif has delay 0 for the first frame set in error
|
||||||
x2 = pyvips.Image.new_from_file(GIF_ANIM_FILE, n=2)
|
assert x2.get("delay") == [0, 50, 50, 50, 50]
|
||||||
assert x2.height == 2 * x1.height
|
assert x2.get("loop") == 32760
|
||||||
page_height = x2.get("page-height")
|
assert x2.get("background") == [255, 255, 255]
|
||||||
assert page_height == x1.height
|
# test deprecated fields too
|
||||||
|
assert x2.get("gif-loop") == 32759
|
||||||
|
assert x2.get("gif-delay") == 0
|
||||||
|
|
||||||
x2 = pyvips.Image.new_from_file(GIF_ANIM_FILE, n=-1)
|
# test every pixel
|
||||||
assert x2.height == 5 * x1.height
|
x1 = pyvips.Image.new_from_file(GIF_ANIM_FILE, n=-1)
|
||||||
# our test gif has delay 0 for the first frame set in error
|
x2 = pyvips.Image.new_from_file(GIF_ANIM_EXPECTED_PNG_FILE)
|
||||||
assert x2.get("delay") == [0, 50, 50, 50, 50]
|
assert (x1 - x2).abs().max() == 0
|
||||||
|
|
||||||
x2 = pyvips.Image.new_from_file(GIF_ANIM_FILE, page=1, n=-1)
|
# test page handling
|
||||||
assert x2.height == 4 * x1.height
|
x1 = pyvips.Image.new_from_file(GIF_ANIM_FILE)
|
||||||
|
x2 = pyvips.Image.new_from_file(GIF_ANIM_FILE, n=2)
|
||||||
|
assert x2.height == 2 * x1.height
|
||||||
|
page_height = x2.get("page-height")
|
||||||
|
assert page_height == x1.height
|
||||||
|
|
||||||
x1 = pyvips.Image.new_from_file(GIF_ANIM_FILE, n=-1)
|
x2 = pyvips.Image.new_from_file(GIF_ANIM_FILE, n=-1)
|
||||||
x2 = pyvips.Image.new_from_file(GIF_ANIM_EXPECTED_PNG_FILE)
|
assert x2.height == 5 * x1.height
|
||||||
assert (x1 - x2).abs().max() == 0
|
|
||||||
|
x2 = pyvips.Image.new_from_file(GIF_ANIM_FILE, page=1, n=-1)
|
||||||
|
assert x2.height == 4 * x1.height
|
||||||
|
|
||||||
@skip_if_no("gifload")
|
@skip_if_no("gifload")
|
||||||
def test_gifload_animation_dispose_background(self):
|
def test_gifload_animation_dispose_background(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user