diff --git a/Tests/images/tiff_wrong_bits_per_sample_3.tiff b/Tests/images/tiff_wrong_bits_per_sample_3.tiff new file mode 100644 index 000000000..43526b157 Binary files /dev/null and b/Tests/images/tiff_wrong_bits_per_sample_3.tiff differ diff --git a/Tests/test_file_tiff.py b/Tests/test_file_tiff.py index 16c43b00f..87e0c2d25 100644 --- a/Tests/test_file_tiff.py +++ b/Tests/test_file_tiff.py @@ -92,17 +92,33 @@ class TestFileTiff: assert_image_equal_tofile(im, "Tests/images/hopper.tif") @pytest.mark.parametrize( - "file_name,mode,size,offset", + "file_name,mode,size,tile", [ - ("tiff_wrong_bits_per_sample.tiff", "RGBA", (52, 53), 160), - ("tiff_wrong_bits_per_sample_2.tiff", "RGB", (16, 16), 8), + ( + "tiff_wrong_bits_per_sample.tiff", + "RGBA", + (52, 53), + [("raw", (0, 0, 52, 53), 160, ("RGBA", 0, 1))], + ), + ( + "tiff_wrong_bits_per_sample_2.tiff", + "RGB", + (16, 16), + [("raw", (0, 0, 16, 16), 8, ("RGB", 0, 1))], + ), + ( + "tiff_wrong_bits_per_sample_3.tiff", + "RGBA", + (512, 256), + [("libtiff", (0, 0, 512, 256), 0, ("RGBA", "tiff_lzw", False, 48782))], + ), ], ) - def test_wrong_bits_per_sample(self, file_name, mode, size, offset): + def test_wrong_bits_per_sample(self, file_name, mode, size, tile): with Image.open("Tests/images/" + file_name) as im: assert im.mode == mode assert im.size == size - assert im.tile == [("raw", (0, 0) + size, offset, (mode, 0, 1))] + assert im.tile == tile im.load() def test_set_legacy_api(self):