Use monkey-patched openjpeg version when library not available. Closes #92

This commit is contained in:
John Evans 2013-07-30 09:52:53 -04:00
commit 3f417a30b1

View file

@ -30,6 +30,7 @@ import numpy as np
from glymur import Jp2k
import glymur
from .fixtures import OPENJPEG_VERSION
from .fixtures import OPENJP2_IS_V2_OFFICIAL
from .fixtures import *
@ -7801,7 +7802,8 @@ class TestSuite15(unittest.TestCase):
jfile = os.path.join(data_root, 'input/conformance/file9.jp2')
jp2k = Jp2k(jfile)
jpdata = jp2k.read()
if glymur.lib.openjpeg.version().startswith('1.3'):
if re.match('[01]\.3', OPENJPEG_VERSION):
# Version 1.3 reads in the image as the palette indices.
self.assertEqual(jpdata.shape, (512, 768))
else:
self.assertEqual(jpdata.shape, (512, 768, 3))
@ -7840,7 +7842,7 @@ class TestSuite15(unittest.TestCase):
data = jp2.read()
self.assertTrue(True)
@unittest.skipIf(int(glymur.lib.openjpeg.version().split('.')[1]) < 5,
@unittest.skipIf(re.match('[01]\.[34]', OPENJPEG_VERSION),
"Segfaults openjpeg 1.4 and earlier.")
def test_NR_DEC_broken2_jp2_5_decode(self):
# Null pointer access
@ -7863,7 +7865,7 @@ class TestSuite15(unittest.TestCase):
with self.assertRaises(ValueError) as ce:
d = j.read()
@unittest.skipIf(int(glymur.lib.openjpeg.version().split('.')[1]) < 5,
@unittest.skipIf(re.match('[01]\.[34]', OPENJPEG_VERSION),
"Segfaults openjpeg 1.4 and earlier.")
def test_NR_DEC_broken4_jp2_7_decode(self):
# Null pointer access