Merge pull request #5232 from radarhere/libtiff_test

Moved test that requires libtiff
This commit is contained in:
Andrew Murray 2021-02-01 18:40:07 +11:00 committed by GitHub
commit 023dbe3925
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 9 deletions

View File

@ -9,6 +9,7 @@ from ctypes import c_float
import pytest import pytest
from PIL import Image, ImageFilter, TiffImagePlugin, TiffTags, features from PIL import Image, ImageFilter, TiffImagePlugin, TiffTags, features
from PIL.TiffImagePlugin import SUBIFD
from .helper import ( from .helper import (
assert_image_equal, assert_image_equal,
@ -324,6 +325,14 @@ class TestFileLibTiff(LibTiffTestCase):
) )
TiffImagePlugin.WRITE_LIBTIFF = False TiffImagePlugin.WRITE_LIBTIFF = False
def test_subifd(self, tmp_path):
outfile = str(tmp_path / "temp.tif")
with Image.open("Tests/images/g4_orientation_6.tif") as im:
im.tag_v2[SUBIFD] = 10000
# Should not segfault
im.save(outfile)
def test_xmlpacket_tag(self, tmp_path): def test_xmlpacket_tag(self, tmp_path):
TiffImagePlugin.WRITE_LIBTIFF = True TiffImagePlugin.WRITE_LIBTIFF = True

View File

@ -4,7 +4,7 @@ from io import BytesIO
import pytest import pytest
from PIL import Image, TiffImagePlugin from PIL import Image, TiffImagePlugin
from PIL.TiffImagePlugin import RESOLUTION_UNIT, SUBIFD, X_RESOLUTION, Y_RESOLUTION from PIL.TiffImagePlugin import RESOLUTION_UNIT, X_RESOLUTION, Y_RESOLUTION
from .helper import ( from .helper import (
assert_image_equal, assert_image_equal,
@ -161,14 +161,6 @@ class TestFileTiff:
reloaded.load() reloaded.load()
assert (round(dpi), round(dpi)) == reloaded.info["dpi"] assert (round(dpi), round(dpi)) == reloaded.info["dpi"]
def test_subifd(self, tmp_path):
outfile = str(tmp_path / "temp.tif")
with Image.open("Tests/images/g4_orientation_6.tif") as im:
im.tag_v2[SUBIFD] = 10000
# Should not segfault
im.save(outfile)
def test_save_setting_missing_resolution(self): def test_save_setting_missing_resolution(self):
b = BytesIO() b = BytesIO()
Image.open("Tests/images/10ct_32bit_128.tiff").save( Image.open("Tests/images/10ct_32bit_128.tiff").save(