Skip to content

Commit

Permalink
Merge pull request #5232 from radarhere/libtiff_test
Browse files Browse the repository at this point in the history
Moved test that requires libtiff
  • Loading branch information
radarhere committed Feb 1, 2021
2 parents 473b24e + eb7e5d2 commit 023dbe3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
9 changes: 9 additions & 0 deletions Tests/test_file_libtiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import pytest

from PIL import Image, ImageFilter, TiffImagePlugin, TiffTags, features
from PIL.TiffImagePlugin import SUBIFD

from .helper import (
assert_image_equal,
Expand Down Expand Up @@ -324,6 +325,14 @@ def check_tags(tiffinfo):
)
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):
TiffImagePlugin.WRITE_LIBTIFF = True

Expand Down
10 changes: 1 addition & 9 deletions Tests/test_file_tiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytest

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 (
assert_image_equal,
Expand Down Expand Up @@ -161,14 +161,6 @@ def test_save_dpi_rounding(self, tmp_path):
reloaded.load()
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):
b = BytesIO()
Image.open("Tests/images/10ct_32bit_128.tiff").save(
Expand Down

0 comments on commit 023dbe3

Please sign in to comment.