diff --git a/glymur/test/test_format_corpus.py b/glymur/test/test_format_corpus.py index 14c0830..28e1d4d 100644 --- a/glymur/test/test_format_corpus.py +++ b/glymur/test/test_format_corpus.py @@ -66,5 +66,20 @@ class TestSuite(unittest.TestCase): with self.assertRaises(OSError): j2k.read(rlevel=-1) + def test_balloon_trunc3(self): + # Most of last tile is missing. + jfile = os.path.join(data_root, + 'jp2k-test/byteCorruption/balloon_trunc3.jp2') + j2k = Jp2k(jfile) + with self.assertWarns(UserWarning): + c = j2k.get_codestream(header_only=False) + + # The last segment is truncated, so there should not be an EOC marker. + self.assertNotEqual(c.segment[-1].marker_id, 'EOC') + + # Should error out, it does not. + #with self.assertRaises(OSError): + # j2k.read(rlevel=-1) + if __name__ == "__main__": unittest.main()