added test for image component parameters type
This commit is contained in:
parent
a783f6f139
commit
0815db6c0d
3 changed files with 28 additions and 0 deletions
|
|
@ -548,6 +548,13 @@ class ImageComptParmType(ctypes.Structure):
|
||||||
# signed (1) / unsigned (0)
|
# signed (1) / unsigned (0)
|
||||||
("sgnd", ctypes.c_uint32)]
|
("sgnd", 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 TccpInfo(ctypes.Structure):
|
class TccpInfo(ctypes.Structure):
|
||||||
"""Tile-component coding parameters information.
|
"""Tile-component coding parameters information.
|
||||||
|
|
|
||||||
|
|
@ -116,3 +116,14 @@ default_compression_parameters_type = """<class 'glymur.lib.openjp2.CompressionP
|
||||||
mct_data: None
|
mct_data: None
|
||||||
max_cs_size: 0
|
max_cs_size: 0
|
||||||
rsiz: 0"""
|
rsiz: 0"""
|
||||||
|
|
||||||
|
default_image_component_parameters = """<class 'glymur.lib.openjp2.ImageComptParmType'>:
|
||||||
|
dx: 0
|
||||||
|
dy: 0
|
||||||
|
w: 0
|
||||||
|
h: 0
|
||||||
|
x0: 0
|
||||||
|
y0: 0
|
||||||
|
prec: 0
|
||||||
|
bpp: 0
|
||||||
|
sgnd: 0"""
|
||||||
|
|
|
||||||
|
|
@ -54,4 +54,14 @@ class TestPrintingOpenjp2(unittest.TestCase):
|
||||||
expected = fixtures.default_compression_parameters_type
|
expected = fixtures.default_compression_parameters_type
|
||||||
self.assertEqual(actual, expected)
|
self.assertEqual(actual, expected)
|
||||||
|
|
||||||
|
def test_default_component_parameters(self):
|
||||||
|
"""printing default image component parameters"""
|
||||||
|
icpt = glymur.lib.openjp2.ImageComptParmType()
|
||||||
|
with patch('sys.stdout', new=StringIO()) as fake_out:
|
||||||
|
print(icpt)
|
||||||
|
actual = fake_out.getvalue().strip()
|
||||||
|
expected = fixtures.default_image_component_parameters
|
||||||
|
self.assertEqual(actual, expected)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue