Added test for empty GPS IFD

This commit is contained in:
Andrew Murray 2020-09-02 21:14:36 +10:00
parent e96109b93c
commit 186a4723c8
2 changed files with 19 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -8,6 +8,7 @@ from PIL import (
ExifTags,
Image,
ImageFile,
ImageOps,
JpegImagePlugin,
UnidentifiedImageError,
features,
@ -249,6 +250,24 @@ class TestFileJpeg:
exif = reloaded._getexif()
assert exif[gps_index] == expected_exif_gps
def test_empty_exif_gps(self):
with Image.open("Tests/images/empty_gps_ifd.jpg") as im:
exif = im.getexif()
del exif[0x8769]
# Assert that it needs to be transposed
assert exif[0x0112] == Image.TRANSVERSE
# Assert that the GPS IFD is present and empty
assert exif[0x8825] == {}
transposed = ImageOps.exif_transpose(im)
exif = transposed.getexif()
assert exif[0x8825] == {}
# Assert that it was transposed
assert 0x0112 not in exif
def test_exif_rollback(self):
# rolling back exif support in 3.1 to pre-3.0 formatting.
# expected from 2.9, with b/u qualifiers switched for 3.2 compatibility