Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libwebp 1.2.2 fixed endian bugs #5984

Merged
merged 2 commits into from Mar 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 11 additions & 3 deletions Tests/test_file_webp_animated.py
@@ -1,6 +1,7 @@
import pytest
from packaging.version import parse as parse_version

from PIL import Image
from PIL import Image, features

from .helper import (
assert_image_equal,
Expand All @@ -27,7 +28,6 @@ def test_n_frames():
assert im.is_animated


@pytest.mark.xfail(is_big_endian(), reason="Fails on big-endian")
def test_write_animation_L(tmp_path):
"""
Convert an animated GIF to animated WebP, then compare the frame count, and first
Expand All @@ -46,14 +46,18 @@ def test_write_animation_L(tmp_path):
orig.load()
im.load()
assert_image_similar(im, orig.convert("RGBA"), 32.9)

if is_big_endian():
webp = parse_version(features.version_module("webp"))
if webp < parse_version("1.2.2"):
pytest.skip("Fails with libwebp earlier than 1.2.2")
orig.seek(orig.n_frames - 1)
im.seek(im.n_frames - 1)
orig.load()
im.load()
assert_image_similar(im, orig.convert("RGBA"), 32.9)


@pytest.mark.xfail(is_big_endian(), reason="Fails on big-endian")
def test_write_animation_RGB(tmp_path):
"""
Write an animated WebP from RGB frames, and ensure the frames
Expand All @@ -69,6 +73,10 @@ def check(temp_file):
assert_image_equal(im, frame1.convert("RGBA"))

# Compare second frame to original
if is_big_endian():
webp = parse_version(features.version_module("webp"))
if webp < parse_version("1.2.2"):
pytest.skip("Fails with libwebp earlier than 1.2.2")
im.seek(1)
im.load()
assert_image_equal(im, frame2.convert("RGBA"))
Expand Down