Checking for ICC profile that is None. #183
This commit is contained in:
parent
df651a66d8
commit
77d2ab194a
3 changed files with 25 additions and 6 deletions
|
|
@ -359,6 +359,9 @@ class ColourSpecificationBox(Jp2kBox):
|
||||||
else:
|
else:
|
||||||
# 2.7 has trouble pretty-printing ordered dicts so we just have
|
# 2.7 has trouble pretty-printing ordered dicts so we just have
|
||||||
# to print as a regular dict in this case.
|
# to print as a regular dict in this case.
|
||||||
|
if self.icc_profile is None:
|
||||||
|
msg += '\n ICC Profile: None'
|
||||||
|
else:
|
||||||
if sys.hexversion < 0x03000000:
|
if sys.hexversion < 0x03000000:
|
||||||
icc_profile = dict(self.icc_profile)
|
icc_profile = dict(self.icc_profile)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -582,3 +582,8 @@ issue_182_cmap = """Component Mapping Box (cmap) @ (130, 24)
|
||||||
Component 0 ==> palette column 0
|
Component 0 ==> palette column 0
|
||||||
Component 1 ==> palette column 0
|
Component 1 ==> palette column 0
|
||||||
Component 2 ==> 2"""
|
Component 2 ==> 2"""
|
||||||
|
|
||||||
|
issue_183_colr = """Colour Specification Box (colr) @ (62, 12)
|
||||||
|
Method: restricted ICC profile
|
||||||
|
Precedence: 0
|
||||||
|
ICC Profile: None"""
|
||||||
|
|
|
||||||
|
|
@ -920,6 +920,17 @@ class TestPrinting(unittest.TestCase):
|
||||||
actual = fake_out.getvalue().strip()
|
actual = fake_out.getvalue().strip()
|
||||||
self.assertEqual(actual, fixtures.issue_182_cmap)
|
self.assertEqual(actual, fixtures.issue_182_cmap)
|
||||||
|
|
||||||
|
def test_issue183(self):
|
||||||
|
filename = opj_data_file('input/nonregression/orb-blue10-lin-jp2.jp2')
|
||||||
|
|
||||||
|
with warnings.catch_warnings():
|
||||||
|
# Ignore warning about bad pclr box.
|
||||||
|
warnings.simplefilter("ignore")
|
||||||
|
jp2 = Jp2k(filename)
|
||||||
|
with patch('sys.stdout', new=StringIO()) as fake_out:
|
||||||
|
print(jp2.box[2].box[1])
|
||||||
|
actual = fake_out.getvalue().strip()
|
||||||
|
self.assertEqual(actual, fixtures.issue_183_colr)
|
||||||
|
|
||||||
@unittest.skipIf(sys.hexversion < 0x03000000,
|
@unittest.skipIf(sys.hexversion < 0x03000000,
|
||||||
"Ordered dicts not printing well in 2.7")
|
"Ordered dicts not printing well in 2.7")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue