mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 18:56:17 +03:00
Moved libtiff test into libtiff test file
This commit is contained in:
parent
d3ae7a1c46
commit
4de10089f0
|
@ -840,3 +840,26 @@ class TestFileLibTiff(LibTiffTestCase):
|
||||||
im.load()
|
im.load()
|
||||||
|
|
||||||
self.assert_image_similar(base_im, im, 0.7)
|
self.assert_image_similar(base_im, im, 0.7)
|
||||||
|
|
||||||
|
def test_sampleformat_not_corrupted(self):
|
||||||
|
# Assert that a TIFF image with SampleFormat=UINT tag is not corrupted
|
||||||
|
# when saving to a new file.
|
||||||
|
# Pillow 6.0 fails with "OSError: cannot identify image file".
|
||||||
|
import base64
|
||||||
|
|
||||||
|
tiff = io.BytesIO(
|
||||||
|
base64.b64decode(
|
||||||
|
b"SUkqAAgAAAAPAP4ABAABAAAAAAAAAAABBAABAAAAAQAAAAEBBAABAAAAAQAA"
|
||||||
|
b"AAIBAwADAAAAwgAAAAMBAwABAAAACAAAAAYBAwABAAAAAgAAABEBBAABAAAA"
|
||||||
|
b"4AAAABUBAwABAAAAAwAAABYBBAABAAAAAQAAABcBBAABAAAACwAAABoBBQAB"
|
||||||
|
b"AAAAyAAAABsBBQABAAAA0AAAABwBAwABAAAAAQAAACgBAwABAAAAAQAAAFMB"
|
||||||
|
b"AwADAAAA2AAAAAAAAAAIAAgACAABAAAAAQAAAAEAAAABAAAAAQABAAEAAAB4"
|
||||||
|
b"nGNgYAAAAAMAAQ=="
|
||||||
|
)
|
||||||
|
)
|
||||||
|
out = io.BytesIO()
|
||||||
|
with Image.open(tiff) as im:
|
||||||
|
im.save(out, format="tiff")
|
||||||
|
out.seek(0)
|
||||||
|
with Image.open(out) as im:
|
||||||
|
im.load()
|
||||||
|
|
|
@ -2,7 +2,7 @@ import logging
|
||||||
import sys
|
import sys
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
from PIL import Image, TiffImagePlugin, features
|
from PIL import Image, TiffImagePlugin
|
||||||
from PIL._util import py3
|
from PIL._util import py3
|
||||||
from PIL.TiffImagePlugin import RESOLUTION_UNIT, X_RESOLUTION, Y_RESOLUTION
|
from PIL.TiffImagePlugin import RESOLUTION_UNIT, X_RESOLUTION, Y_RESOLUTION
|
||||||
|
|
||||||
|
@ -587,30 +587,6 @@ class TestFileTiff(PillowTestCase):
|
||||||
im.load()
|
im.load()
|
||||||
self.assertFalse(fp.closed)
|
self.assertFalse(fp.closed)
|
||||||
|
|
||||||
@unittest.skipUnless(features.check("libtiff"), "libtiff not installed")
|
|
||||||
def test_sampleformat_not_corrupted(self):
|
|
||||||
# Assert that a TIFF image with SampleFormat=UINT tag is not corrupted
|
|
||||||
# when saving to a new file.
|
|
||||||
# Pillow 6.0 fails with "OSError: cannot identify image file".
|
|
||||||
import base64
|
|
||||||
|
|
||||||
tiff = BytesIO(
|
|
||||||
base64.b64decode(
|
|
||||||
b"SUkqAAgAAAAPAP4ABAABAAAAAAAAAAABBAABAAAAAQAAAAEBBAABAAAAAQAA"
|
|
||||||
b"AAIBAwADAAAAwgAAAAMBAwABAAAACAAAAAYBAwABAAAAAgAAABEBBAABAAAA"
|
|
||||||
b"4AAAABUBAwABAAAAAwAAABYBBAABAAAAAQAAABcBBAABAAAACwAAABoBBQAB"
|
|
||||||
b"AAAAyAAAABsBBQABAAAA0AAAABwBAwABAAAAAQAAACgBAwABAAAAAQAAAFMB"
|
|
||||||
b"AwADAAAA2AAAAAAAAAAIAAgACAABAAAAAQAAAAEAAAABAAAAAQABAAEAAAB4"
|
|
||||||
b"nGNgYAAAAAMAAQ=="
|
|
||||||
)
|
|
||||||
)
|
|
||||||
out = BytesIO()
|
|
||||||
with Image.open(tiff) as im:
|
|
||||||
im.save(out, format="tiff")
|
|
||||||
out.seek(0)
|
|
||||||
with Image.open(out) as im:
|
|
||||||
im.load()
|
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipUnless(sys.platform.startswith("win32"), "Windows only")
|
@unittest.skipUnless(sys.platform.startswith("win32"), "Windows only")
|
||||||
class TestFileTiffW32(PillowTestCase):
|
class TestFileTiffW32(PillowTestCase):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user