merge branch 'issue308' into devel

Conflicts:
	glymur/test/test_opj_suite.py
This commit is contained in:
John Evans 2015-01-01 09:53:02 -05:00
commit 3eae87543c
2 changed files with 13 additions and 29 deletions

View file

@ -102,28 +102,6 @@ class TestWarnings(unittest.TestCase):
with self.assertWarnsRegex(UserWarning, regex):
Jp2k(jfile)
def test_NR_broken_jp2_dump(self):
"""
The colr box has a ridiculously incorrect box length.
"""
jfile = opj_data_file('input/nonregression/broken.jp2')
regex = re.compile(r'''b'colr'\sbox\shas\sincorrect\sbox\slength\s
\(\d+\)''',
re.VERBOSE)
with self.assertWarnsRegex(UserWarning, regex):
Jp2k(jfile)
def test_NR_broken2_jp2_dump(self):
"""
Invalid marker ID on codestream.
"""
jfile = opj_data_file('input/nonregression/broken2.jp2')
regex = re.compile(r'''Invalid\smarker\sid\sencountered\sat\sbyte\s
\d+\sin\scodestream:\s*"0x[a-fA-F0-9]{4}"''',
re.VERBOSE)
with self.assertWarnsRegex(UserWarning, regex):
Jp2k(jfile)
def test_bad_rsiz(self):
"""Should warn if RSIZ is bad. Issue196"""
filename = opj_data_file('input/nonregression/edf_c2_1002767.jp2')

View file

@ -359,11 +359,14 @@ class TestSuiteWarns(MetadataBase):
jpdata = jp2k[:]
self.assertEqual(jpdata.shape, (512, 768, 3))
def test_NR_broken_jp2_dump(self):
def test_NR_broken1_jp2_dump(self):
jfile = opj_data_file('input/nonregression/broken1.jp2')
with self.assertWarns(UserWarning):
# colr box has bad length.
# The colr box has a ridiculously incorrect box length.
regex = re.compile(r'''b'colr'\sbox\shas\sincorrect\sbox\slength\s
\(\d+\)''',
re.VERBOSE)
with self.assertWarnsRegex(UserWarning, regex):
jp2 = Jp2k(jfile)
ids = [box.box_id for box in jp2.box]
@ -584,13 +587,16 @@ class TestSuite2point0(unittest.TestCase):
@unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG)
def test_NR_DEC_broken2_jp2_5_decode(self):
# Null pointer access
"""
Invalid marker ID on codestream, Null pointer access upon read.
"""
jfile = opj_data_file('input/nonregression/broken2.jp2')
regex = re.compile(r'''Invalid\smarker\sid\sencountered\sat\sbyte\s
\d+\sin\scodestream:\s*"0x[a-fA-F0-9]{4}"''',
re.VERBOSE)
with self.assertRaises(IOError):
with self.assertWarns(UserWarning):
# Invalid marker ID.
with self.assertWarnsRegex(UserWarning, regex):
Jp2k(jfile)[:]
self.assertTrue(True)
@unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG)
def test_NR_DEC_broken4_jp2_7_decode(self):