Skip to content

Commit 97df237

Browse files
committed
Moved test into separate function
1 parent 400716d commit 97df237

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

Tests/test_file_apng.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -440,19 +440,24 @@ def test_apng_save_duration_loop(tmp_path):
440440
assert im.n_frames == 1
441441
assert im.info.get("duration") == 750
442442

443-
# test removal of duplicated frames with a single duration
444-
frame.save(test_file, save_all=True, append_images=[frame, frame], duration=500)
445-
with Image.open(test_file) as im:
446-
assert im.n_frames == 1
447-
assert im.info.get("duration") == 1500
448-
449443
# test info duration
450444
frame.info["duration"] = 750
451445
frame.save(test_file, save_all=True)
452446
with Image.open(test_file) as im:
453447
assert im.info.get("duration") == 750
454448

455449

450+
def test_apng_save_duplicate_duration(tmp_path):
451+
test_file = str(tmp_path / "temp.png")
452+
frame = Image.new("RGB", (1, 1))
453+
454+
# Test a single duration is correctly combined across duplicate frames
455+
frame.save(test_file, save_all=True, append_images=[frame, frame], duration=500)
456+
with Image.open(test_file) as im:
457+
assert im.n_frames == 1
458+
assert im.info.get("duration") == 1500
459+
460+
456461
def test_apng_save_disposal(tmp_path):
457462
test_file = str(tmp_path / "temp.png")
458463
size = (128, 64)

0 commit comments

Comments
 (0)