Merge branch 'issue92' into devel

This commit is contained in:
John Evans 2013-07-30 09:54:05 -04:00
commit fc147a29e5
4 changed files with 14 additions and 7 deletions

View file

@ -28,9 +28,6 @@ else:
# Does not really matter. But version should not be called if there is no
# OpenJPEG library found.
_MINOR = 0
# Redefine version so that we can use it.
def version():
return '0.0.0'
class EventMgrType(ctypes.Structure):

View file

@ -5,6 +5,14 @@ import numpy as np
import glymur
# Need to know the openjpeg version. If openjpeg is not installed, we use
# '0.0.0'
OPENJPEG_VERSION = '0.0.0'
if glymur.lib.openjpeg.OPENJPEG is not None:
OPENJPEG_VERSION = glymur.lib.openjpeg.version()
# Need to know of the libopenjp2 version is the official 2.0.0 release and NOT
# the 2.0+ development version.
OPENJP2_IS_V2_OFFICIAL = False
if glymur.lib.openjp2.OPENJP2 is not None:
if not hasattr(glymur.lib.openjp2.OPENJP2,

View file

@ -66,7 +66,7 @@ class TestCallbacks(unittest.TestCase):
self.assertEqual(actual, expected)
@unittest.skipIf(glymur.lib.openjp2.OPENJPEG is None,
@unittest.skipIf(glymur.lib.openjpeg.OPENJPEG is None,
"Missing openjpeg library.")
class TestCallbacks15(unittest.TestCase):
"""This test suite is for OpenJPEG 1.5.1 properties.

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