From 7cf351cfc50dcbda82270c80e44e32643688a7a9 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Wed, 25 Sep 2024 20:37:41 +1000 Subject: [PATCH] Added additional test --- Tests/test_file_tiff.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Tests/test_file_tiff.py b/Tests/test_file_tiff.py index 6d76ccca6..af766022b 100644 --- a/Tests/test_file_tiff.py +++ b/Tests/test_file_tiff.py @@ -728,6 +728,20 @@ class TestFileTiff: with Image.open(mp) as reread: assert reread.n_frames == 3 + def test_fixoffsets(self) -> None: + b = BytesIO(b"II\x2a\x00\x00\x00\x00\x00") + with TiffImagePlugin.AppendingTiffWriter(b) as a: + b.seek(0) + a.fixOffsets(1, isShort=True) + + b.seek(0) + a.fixOffsets(1, isLong=True) + + # Neither short nor long + b.seek(0) + with pytest.raises(RuntimeError): + a.fixOffsets(1) + def test_saving_icc_profile(self, tmp_path: Path) -> None: # Tests saving TIFF with icc_profile set. # At the time of writing this will only work for non-compressed tiffs