forked from pool/python-opengl-accelerate
Accepting request 966568 from home:sbradnick:branches:devel:languages:python
- Adding _service file - Cleaning up Source0 declaration since PyPI doesn't have a tarball - Updating hash for 'accelerate/test' Source[1,2] - Adding code to %prep section to deal w/ how _service pulls down files for the gzip'd tarball - Update to 3.1.6 * Pulled directly from https://github.com/mcfletch/pyopengl since pypi.org (via py2pack fetch) doesn't have this version available. * Seems that some packages which use PyOpenGL and accelerate have a soft requirement that they're the same version. OBS-URL: https://build.opensuse.org/request/show/966568 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-opengl-accelerate?expand=0&rev=18
This commit is contained in:
@@ -3,12 +3,18 @@ from OpenGL.arrays import arraydatatype as adt
|
||||
from OpenGL.arrays import vbo
|
||||
from OpenGL import GL
|
||||
from OpenGL._bytes import integer_types
|
||||
import pytest
|
||||
try:
|
||||
import numpy
|
||||
except ImportError:
|
||||
numpy = None
|
||||
try:
|
||||
import OpenGL_accelerate
|
||||
except ImportError:
|
||||
pytest.skip('Accelerate not installed, skipping', allow_module_level=True)
|
||||
|
||||
class _BaseTest( object ):
|
||||
array = None
|
||||
def setUp( self ):
|
||||
self.handler = adt.ArrayDatatype
|
||||
assert self.handler.isAccelerated
|
||||
@@ -38,39 +44,41 @@ class _BaseTest( object ):
|
||||
p = self.handler.arrayToGLType( self.array )
|
||||
assert p == GL.GL_FLOAT
|
||||
|
||||
if numpy:
|
||||
# Skip if modifies the functions, which are *shared* between the
|
||||
# classes...
|
||||
#@pytest.mark.skipif( not numpy, reason="Numpy not available")
|
||||
class TestNumpy( _BaseTest, unittest.TestCase ):
|
||||
def setUp( self ):
|
||||
self.array = numpy.array( [[1,2,3],[4,5,6]],'f')
|
||||
super(TestNumpy,self).setUp()
|
||||
def test_dataPointer( self ):
|
||||
p = self.handler.dataPointer( self.array )
|
||||
assert isinstance( p, integer_types)
|
||||
assert p == self.array.ctypes.data
|
||||
def test_zeros( self ):
|
||||
p = self.handler.zeros( (2,3,4), 'f' )
|
||||
assert p.shape == (2,3,4)
|
||||
assert p.dtype == numpy.float32
|
||||
def test_asArrayConvert( self ):
|
||||
p = self.handler.asArray( self.array, GL.GL_DOUBLE )
|
||||
assert p is not self.array
|
||||
assert p.dtype == numpy.float64
|
||||
p = self.handler.asArray( self.array, 'd' )
|
||||
assert p is not self.array
|
||||
assert p.dtype == numpy.float64
|
||||
def test_zeros_typed( self ):
|
||||
z = self.handler.zeros( (2,3,4), GL.GL_FLOAT)
|
||||
assert z.shape == (2,3,4)
|
||||
assert z.dtype == numpy.float32
|
||||
def test_downconvert( self ):
|
||||
p = self.handler.asArray( numpy.array( [1,2,3],'d'), GL.GL_FLOAT )
|
||||
assert p.dtype == numpy.float32
|
||||
def test_zeros_small( self ):
|
||||
z = self.handler.zeros( 0, GL.GL_BYTE )
|
||||
assert z.dtype == numpy.byte, z
|
||||
# Skip if modifies the functions, which are *shared* between the
|
||||
# classes...
|
||||
@pytest.mark.skipif( not numpy, reason="Numpy not available")
|
||||
class TestNumpy( _BaseTest, unittest.TestCase ):
|
||||
def setUp( self ):
|
||||
super(TestNumpy,self).setUp()
|
||||
self.array = numpy.array( [[1,2,3],[4,5,6]],'f')
|
||||
handler = adt.ArrayDatatype.getHandler( self.array )
|
||||
handler.registerReturn( )
|
||||
|
||||
def test_dataPointer( self ):
|
||||
p = self.handler.dataPointer( self.array )
|
||||
assert isinstance( p, integer_types)
|
||||
assert p == self.array.ctypes.data
|
||||
def test_zeros( self ):
|
||||
p = self.handler.zeros( (2,3,4), 'f' )
|
||||
assert p.shape == (2,3,4)
|
||||
assert p.dtype == numpy.float32
|
||||
def test_asArrayConvert( self ):
|
||||
p = self.handler.asArray( self.array, GL.GL_DOUBLE )
|
||||
assert p is not self.array
|
||||
assert p.dtype == numpy.float64
|
||||
p = self.handler.asArray( self.array, 'd' )
|
||||
assert p is not self.array
|
||||
assert p.dtype == numpy.float64
|
||||
def test_zeros_typed( self ):
|
||||
z = self.handler.zeros( (2,3,4), GL.GL_FLOAT)
|
||||
assert z.shape == (2,3,4)
|
||||
assert z.dtype == numpy.float32
|
||||
def test_downconvert( self ):
|
||||
p = self.handler.asArray( numpy.array( [1,2,3],'d'), GL.GL_FLOAT )
|
||||
assert p.dtype == numpy.float32
|
||||
def test_zeros_small( self ):
|
||||
z = self.handler.zeros( (0,), GL.GL_BYTE )
|
||||
assert z.dtype == numpy.byte, z
|
||||
|
||||
class TestVBO( _BaseTest, unittest.TestCase ):
|
||||
def setUp( self ):
|
||||
|
||||
Reference in New Issue
Block a user