From 8b82986348195f2ee53a8c4e409050be7d0ce6a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Komar=C4=8Devi=C4=87?= <4973094+kmilos@users.noreply.github.com> Date: Thu, 3 Jun 2021 14:53:41 +0200 Subject: [PATCH] Add multiple strip saving test --- Tests/test_file_libtiff.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Tests/test_file_libtiff.py b/Tests/test_file_libtiff.py index b7ec00ef16a..e2f0df84a8c 100644 --- a/Tests/test_file_libtiff.py +++ b/Tests/test_file_libtiff.py @@ -9,7 +9,7 @@ import pytest from PIL import Image, ImageFilter, TiffImagePlugin, TiffTags, features -from PIL.TiffImagePlugin import SUBIFD +from PIL.TiffImagePlugin import STRIPOFFSETS, SUBIFD from .helper import ( assert_image_equal, @@ -967,3 +967,12 @@ def test_realloc_overflow(self): # Assert that the error code is IMAGING_CODEC_MEMORY assert str(e.value) == "-9" TiffImagePlugin.READ_LIBTIFF = False + + def test_save_multistrip(self, tmp_path): + im = hopper("RGB").resize((256, 256)) + out = str(tmp_path / "temp.tif") + im.save(out, compression="tiff_adobe_deflate") + + with Image.open(out) as im: + # Assert that there are multiple strips + assert len(im.tag_v2[STRIPOFFSETS]) > 1