diff --git a/glymur/test/test_jp2k.py b/glymur/test/test_jp2k.py index 6e328e0..c8e5714 100644 --- a/glymur/test/test_jp2k.py +++ b/glymur/test/test_jp2k.py @@ -854,6 +854,23 @@ class TestJp2kOpjDataRootWarnings(unittest.TestCase): class TestJp2kOpjDataRoot(unittest.TestCase): """These tests should be run by just about all configuration.""" + @unittest.skipIf(os.name == "nt", "NamedTemporaryFile issue on windows") + def test_irreversible(self): + """Irreversible""" + filename = opj_data_file('input/nonregression/issue141.rawl') + expdata = np.fromfile(filename, dtype=np.uint16) + expdata.resize((2816, 2048)) + with tempfile.NamedTemporaryFile(suffix='.j2k') as tfile: + j = Jp2k(tfile.name, 'wb') + j.write(expdata, irreversible=True) + + codestream = j.get_codestream() + self.assertEqual(codestream.segment[2].spcod[8], + glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) + + actdata = j.read() + self.assertTrue(fixtures.mse(actdata, expdata) < 250) + def test_no_cxform_pclr_jp2(self): """Indices for pclr jpxfile if no color transform""" filename = opj_data_file('input/conformance/file9.jp2')