printing of default decompression parameters
This commit is contained in:
parent
25d19226d2
commit
dc0c1950a2
3 changed files with 50 additions and 5 deletions
|
|
@ -201,6 +201,13 @@ class DecompressionParametersType(ctypes.Structure):
|
||||||
# maximum number of tiles
|
# maximum number of tiles
|
||||||
("flags", ctypes.c_uint32)]
|
("flags", 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 CompressionParametersType(ctypes.Structure):
|
class CompressionParametersType(ctypes.Structure):
|
||||||
"""Compression parameters.
|
"""Compression parameters.
|
||||||
|
|
|
||||||
|
|
@ -900,3 +900,22 @@ goodstuff_with_full_header = r"""Codestream:
|
||||||
Step size: [(0, 8), (0, 9), (0, 9), (0, 10), (0, 9), (0, 9), (0, 10), (0, 9), (0, 9), (0, 10), (0, 9), (0, 9), (0, 10), (0, 9), (0, 9), (0, 10)]
|
Step size: [(0, 8), (0, 9), (0, 9), (0, 10), (0, 9), (0, 9), (0, 10), (0, 9), (0, 9), (0, 10), (0, 9), (0, 9), (0, 10), (0, 9), (0, 9), (0, 10)]
|
||||||
SOD marker segment @ (164, 0)
|
SOD marker segment @ (164, 0)
|
||||||
EOC marker segment @ (115218, 0)"""
|
EOC marker segment @ (115218, 0)"""
|
||||||
|
|
||||||
|
decompression_parameters_type = """<class 'glymur.lib.openjp2.DecompressionParametersType'>:
|
||||||
|
cp_reduce: 0
|
||||||
|
cp_layer: 0
|
||||||
|
infile: b''
|
||||||
|
outfile: b''
|
||||||
|
decod_format: -1
|
||||||
|
cod_format: -1
|
||||||
|
DA_x0: 0
|
||||||
|
DA_x1: 0
|
||||||
|
DA_y0: 0
|
||||||
|
DA_y1: 0
|
||||||
|
m_verbose: 0
|
||||||
|
tile_index: 0
|
||||||
|
nb_tile_to_decode: 0
|
||||||
|
jpwl_correct: 0
|
||||||
|
jpwl_exp_comps: 0
|
||||||
|
jpwl_max_tiles: 0
|
||||||
|
flags: 0"""
|
||||||
|
|
|
||||||
|
|
@ -32,12 +32,13 @@ import lxml.etree as ET
|
||||||
import glymur
|
import glymur
|
||||||
from glymur import Jp2k, command_line
|
from glymur import Jp2k, command_line
|
||||||
from . import fixtures
|
from . import fixtures
|
||||||
from .fixtures import OPJ_DATA_ROOT, opj_data_file
|
from .fixtures import (
|
||||||
from .fixtures import WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG
|
OPJ_DATA_ROOT, opj_data_file,
|
||||||
from .fixtures import text_gbr_27, text_gbr_33, text_gbr_34
|
WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG,
|
||||||
|
WINDOWS_TMP_FILE_MSG, text_gbr_27, text_gbr_33, text_gbr_34
|
||||||
|
)
|
||||||
|
|
||||||
|
@unittest.skipIf(os.name == "nt", WINDOWS_TMP_FILE_MSG)
|
||||||
@unittest.skipIf(os.name == "nt", "Temporary file issue on window.")
|
|
||||||
class TestPrinting(unittest.TestCase):
|
class TestPrinting(unittest.TestCase):
|
||||||
"""Tests for verifying how printing works."""
|
"""Tests for verifying how printing works."""
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|
@ -617,6 +618,24 @@ class TestPrinting(unittest.TestCase):
|
||||||
|
|
||||||
self.assertEqual(actual, expected)
|
self.assertEqual(actual, expected)
|
||||||
|
|
||||||
|
@unittest.skipIf(re.match('1|2.0', glymur.version.openjpeg_version),
|
||||||
|
"Requires openjpeg 2.1.0 or higher")
|
||||||
|
class TestPrintingOpenjp2(unittest.TestCase):
|
||||||
|
"""Tests for verifying how printing works on openjp2 library structures."""
|
||||||
|
def setUp(self):
|
||||||
|
self.jp2file = glymur.data.nemo()
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def test_decompression_parameters(self):
|
||||||
|
"""printing DecompressionParametersType"""
|
||||||
|
dparams = glymur.lib.openjp2.set_default_decoder_parameters()
|
||||||
|
with patch('sys.stdout', new=StringIO()) as fake_out:
|
||||||
|
print(dparams)
|
||||||
|
actual = fake_out.getvalue().strip()
|
||||||
|
expected = fixtures.decompression_parameters_type
|
||||||
|
self.assertEqual(actual, expected)
|
||||||
|
|
||||||
@unittest.skipIf(OPJ_DATA_ROOT is None,
|
@unittest.skipIf(OPJ_DATA_ROOT is None,
|
||||||
"OPJ_DATA_ROOT environment variable not set")
|
"OPJ_DATA_ROOT environment variable not set")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue