Merge branch 'issue92' into devel
This commit is contained in:
commit
fc147a29e5
4 changed files with 14 additions and 7 deletions
|
|
@ -28,9 +28,6 @@ else:
|
||||||
# Does not really matter. But version should not be called if there is no
|
# Does not really matter. But version should not be called if there is no
|
||||||
# OpenJPEG library found.
|
# OpenJPEG library found.
|
||||||
_MINOR = 0
|
_MINOR = 0
|
||||||
# Redefine version so that we can use it.
|
|
||||||
def version():
|
|
||||||
return '0.0.0'
|
|
||||||
|
|
||||||
|
|
||||||
class EventMgrType(ctypes.Structure):
|
class EventMgrType(ctypes.Structure):
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,14 @@ import numpy as np
|
||||||
|
|
||||||
import glymur
|
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
|
OPENJP2_IS_V2_OFFICIAL = False
|
||||||
if glymur.lib.openjp2.OPENJP2 is not None:
|
if glymur.lib.openjp2.OPENJP2 is not None:
|
||||||
if not hasattr(glymur.lib.openjp2.OPENJP2,
|
if not hasattr(glymur.lib.openjp2.OPENJP2,
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ class TestCallbacks(unittest.TestCase):
|
||||||
self.assertEqual(actual, expected)
|
self.assertEqual(actual, expected)
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipIf(glymur.lib.openjp2.OPENJPEG is None,
|
@unittest.skipIf(glymur.lib.openjpeg.OPENJPEG is None,
|
||||||
"Missing openjpeg library.")
|
"Missing openjpeg library.")
|
||||||
class TestCallbacks15(unittest.TestCase):
|
class TestCallbacks15(unittest.TestCase):
|
||||||
"""This test suite is for OpenJPEG 1.5.1 properties.
|
"""This test suite is for OpenJPEG 1.5.1 properties.
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import numpy as np
|
||||||
from glymur import Jp2k
|
from glymur import Jp2k
|
||||||
import glymur
|
import glymur
|
||||||
|
|
||||||
|
from .fixtures import OPENJPEG_VERSION
|
||||||
from .fixtures import OPENJP2_IS_V2_OFFICIAL
|
from .fixtures import OPENJP2_IS_V2_OFFICIAL
|
||||||
|
|
||||||
from .fixtures import *
|
from .fixtures import *
|
||||||
|
|
@ -7801,7 +7802,8 @@ class TestSuite15(unittest.TestCase):
|
||||||
jfile = os.path.join(data_root, 'input/conformance/file9.jp2')
|
jfile = os.path.join(data_root, 'input/conformance/file9.jp2')
|
||||||
jp2k = Jp2k(jfile)
|
jp2k = Jp2k(jfile)
|
||||||
jpdata = jp2k.read()
|
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))
|
self.assertEqual(jpdata.shape, (512, 768))
|
||||||
else:
|
else:
|
||||||
self.assertEqual(jpdata.shape, (512, 768, 3))
|
self.assertEqual(jpdata.shape, (512, 768, 3))
|
||||||
|
|
@ -7840,7 +7842,7 @@ class TestSuite15(unittest.TestCase):
|
||||||
data = jp2.read()
|
data = jp2.read()
|
||||||
self.assertTrue(True)
|
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.")
|
"Segfaults openjpeg 1.4 and earlier.")
|
||||||
def test_NR_DEC_broken2_jp2_5_decode(self):
|
def test_NR_DEC_broken2_jp2_5_decode(self):
|
||||||
# Null pointer access
|
# Null pointer access
|
||||||
|
|
@ -7863,7 +7865,7 @@ class TestSuite15(unittest.TestCase):
|
||||||
with self.assertRaises(ValueError) as ce:
|
with self.assertRaises(ValueError) as ce:
|
||||||
d = j.read()
|
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.")
|
"Segfaults openjpeg 1.4 and earlier.")
|
||||||
def test_NR_DEC_broken4_jp2_7_decode(self):
|
def test_NR_DEC_broken4_jp2_7_decode(self):
|
||||||
# Null pointer access
|
# Null pointer access
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue