fix broken test due to upstream openjpeg test suite changes, closes #308

removed test_NR_broken3_jp2_dump, it is mostly just an extreme duplicate
case of test_NR_broken_jp2_dump.  It must be skipped on 32bit platforms
anyway.
This commit is contained in:
John Evans 2015-01-01 09:07:19 -05:00
commit acf6b28bc9
2 changed files with 1 additions and 88 deletions

View file

@ -360,7 +360,7 @@ class TestSuiteWarns(MetadataBase):
self.assertEqual(jpdata.shape, (512, 768, 3))
def test_NR_broken_jp2_dump(self):
jfile = opj_data_file('input/nonregression/broken.jp2')
jfile = opj_data_file('input/nonregression/broken1.jp2')
with self.assertWarns(UserWarning):
# colr box has bad length.

View file

@ -2919,93 +2919,6 @@ class TestSuiteWarns(MetadataBase):
self.assertEqual(jp2.box[-1].main_header.segment[-1].marker_id, 'QCC')
@unittest.skipIf(sys.maxsize < 2**32, 'Do not run on 32-bit platforms')
def test_NR_broken3_jp2_dump(self):
"""
NR_broken3_jp2_dump
The file in question here has a colr box with an erroneous box
length of over 1GB. Don't run it on 32-bit platforms.
"""
jfile = opj_data_file('input/nonregression/broken3.jp2')
with self.assertWarns(UserWarning):
# Bad box length.
jp2 = Jp2k(jfile)
ids = [box.box_id for box in jp2.box]
self.assertEqual(ids, ['jP ', 'ftyp', 'jp2h', 'jp2c'])
ids = [box.box_id for box in jp2.box[2].box]
self.assertEqual(ids, ['ihdr', 'colr'])
self.verifySignatureBox(jp2.box[0])
self.verify_filetype_box(jp2.box[1], FileTypeBox())
ihdr = glymur.jp2box.ImageHeaderBox(152, 203, num_components=3)
self.verifyImageHeaderBox(jp2.box[2].box[0], ihdr)
colr = glymur.jp2box.ColourSpecificationBox(colorspace=SRGB)
self.verifyColourSpecificationBox(jp2.box[2].box[1], colr)
c = jp2.box[3].main_header
ids = [x.marker_id for x in c.segment]
expected = ['SOC', 'SIZ', 'CME', 'COD', 'QCD', 'QCC', 'QCC']
self.assertEqual(ids, expected)
kwargs = {'rsiz': 0, 'xysiz': (203, 152), 'xyosiz': (0, 0),
'xytsiz': (203, 152), 'xytosiz': (0, 0),
'bitdepth': (8, 8, 8),
'signed': (False, False, False),
'xyrsiz': [(1, 1, 1), (1, 1, 1)]}
self.verifySizSegment(c.segment[1],
glymur.codestream.SIZsegment(**kwargs))
pargs = RCME_ISO_8859_1, "Creator: JasPer Vers)on 1.701.0".encode()
self.verifyCMEsegment(c.segment[2], CMEsegment(*pargs))
# COD: Coding style default
self.assertFalse(c.segment[3].scod & 2) # no sop
self.assertFalse(c.segment[3].scod & 4) # no eph
self.assertEqual(c.segment[3].spcod[0], glymur.core.LRCP)
self.assertEqual(c.segment[3].layers, 1) # layers = 1
self.assertEqual(c.segment[3].spcod[3], 1) # mct
self.assertEqual(c.segment[3].spcod[4], 5) # level
self.assertEqual(tuple(c.segment[3].code_block_size),
(64, 64)) # cblk
self.verify_codeblock_style(c.segment[3].spcod[7],
[False, False, False, False, False, False])
self.assertEqual(c.segment[3].spcod[8],
glymur.core.WAVELET_XFORM_5X3_REVERSIBLE)
self.assertEqual(len(c.segment[3].spcod), 9)
# QCD: Quantization default
self.assertEqual(c.segment[4].sqcd & 0x1f, 0)
self.assertEqual(c.segment[4].guard_bits, 2)
self.assertEqual(c.segment[4].mantissa, [0] * 16)
self.assertEqual(c.segment[4].exponent,
[8] + [9, 9, 10] * 5)
# QCC: Quantization component
# associated component
self.assertEqual(c.segment[5].cqcc, 1)
self.assertEqual(c.segment[5].guard_bits, 2)
# quantization type
self.assertEqual(c.segment[5].sqcc & 0x1f, 0) # none
self.assertEqual(c.segment[5].mantissa, [0] * 16)
self.assertEqual(c.segment[5].exponent,
[8] + [9, 9, 10] * 5)
# QCC: Quantization component
# associated component
self.assertEqual(c.segment[6].cqcc, 2)
self.assertEqual(c.segment[6].guard_bits, 2)
# quantization type
self.assertEqual(c.segment[6].sqcc & 0x1f, 0) # none
self.assertEqual(c.segment[6].mantissa, [0] * 16)
self.assertEqual(c.segment[6].exponent,
[8] + [9, 9, 10] * 5)
def test_NR_broken2_jp2_dump(self):
"""
Invalid marker ID in the codestream.