added print support for PocType
This commit is contained in:
parent
1a2aa8397b
commit
3d60d30871
3 changed files with 56 additions and 0 deletions
|
|
@ -138,6 +138,13 @@ class PocType(ctypes.Structure):
|
|||
("tx0_t", ctypes.c_uint32),
|
||||
("ty0_t", ctypes.c_uint32)]
|
||||
|
||||
def __str__(self):
|
||||
msg = "{0}:\n".format(self.__class__)
|
||||
for field_name, _ in self._fields_:
|
||||
msg += " {0}: {1}\n".format(
|
||||
field_name, getattr(self, field_name))
|
||||
return msg
|
||||
|
||||
|
||||
class DecompressionParametersType(ctypes.Structure):
|
||||
"""Decompression parameters.
|
||||
|
|
|
|||
|
|
@ -919,3 +919,41 @@ decompression_parameters_type = """<class 'glymur.lib.openjp2.DecompressionParam
|
|||
jpwl_exp_comps: 0
|
||||
jpwl_max_tiles: 0
|
||||
flags: 0"""
|
||||
|
||||
default_progression_order_changes_type = """<class 'glymur.lib.openjp2.PocType'>:
|
||||
resno0: 0
|
||||
compno0: 0
|
||||
layno1: 0
|
||||
resno1: 0
|
||||
compno1: 0
|
||||
layno0: 0
|
||||
precno0: 0
|
||||
precno1: 0
|
||||
prg1: 0
|
||||
prg: 0
|
||||
progorder: b''
|
||||
tile: 0
|
||||
tx0: 0
|
||||
tx1: 0
|
||||
ty0: 0
|
||||
ty1: 0
|
||||
layS: 0
|
||||
resS: 0
|
||||
compS: 0
|
||||
prcS: 0
|
||||
layE: 0
|
||||
resE: 0
|
||||
compE: 0
|
||||
prcE: 0
|
||||
txS: 0
|
||||
txE: 0
|
||||
tyS: 0
|
||||
tyE: 0
|
||||
dx: 0
|
||||
dy: 0
|
||||
lay_t: 0
|
||||
res_t: 0
|
||||
comp_t: 0
|
||||
prec_t: 0
|
||||
tx0_t: 0
|
||||
ty0_t: 0"""
|
||||
|
|
|
|||
|
|
@ -618,6 +618,7 @@ class TestPrinting(unittest.TestCase):
|
|||
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
@unittest.skipIf(sys.hexversion < 0x03000000, "do not care about 2.7 here")
|
||||
@unittest.skipIf(re.match('1|2.0', glymur.version.openjpeg_version),
|
||||
"Requires openjpeg 2.1.0 or higher")
|
||||
class TestPrintingOpenjp2(unittest.TestCase):
|
||||
|
|
@ -637,6 +638,16 @@ class TestPrintingOpenjp2(unittest.TestCase):
|
|||
expected = fixtures.decompression_parameters_type
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
def test_progression_order_changes(self):
|
||||
"""printing PocType"""
|
||||
ptype = glymur.lib.openjp2.PocType()
|
||||
with patch('sys.stdout', new=StringIO()) as fake_out:
|
||||
print(ptype)
|
||||
actual = fake_out.getvalue().strip()
|
||||
expected = fixtures.default_progression_order_changes_type
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
|
||||
@unittest.skipIf(OPJ_DATA_ROOT is None,
|
||||
"OPJ_DATA_ROOT environment variable not set")
|
||||
@unittest.skipIf(os.name == "nt", "Temporary file issue on window.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue