summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-10-07 19:16:14 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2011-10-07 19:16:14 -0300
commit41f66d647136298310321efecbe7dcef4af3c360 (patch)
tree6c8db2d1655d161b76f8005252e17c9432aa0eda
parent4f2058264daa971d2eb71d1ac68e1f0e00612118 (diff)
downloadpyside-41f66d647136298310321efecbe7dcef4af3c360.tar.gz
pyside-41f66d647136298310321efecbe7dcef4af3c360.tar.xz
pyside-41f66d647136298310321efecbe7dcef4af3c360.zip
Fix qglbuffer test on Python3.
-rw-r--r--tests/QtOpenGL/qglbuffer_test.py14
-rw-r--r--tests/util/py3xfunctions.py4
2 files changed, 11 insertions, 7 deletions
diff --git a/tests/QtOpenGL/qglbuffer_test.py b/tests/QtOpenGL/qglbuffer_test.py
index 09c2c52..8d6d503 100644
--- a/tests/QtOpenGL/qglbuffer_test.py
+++ b/tests/QtOpenGL/qglbuffer_test.py
@@ -5,7 +5,7 @@ import unittest
from PySide.QtCore import QByteArray
from PySide.QtOpenGL import QGLBuffer, QGLWidget
-
+import py3kcompat as py3k
from helper import UsesQApplication
class QGLBufferTest(UsesQApplication):
@@ -16,9 +16,9 @@ class QGLBufferTest(UsesQApplication):
b = QGLBuffer()
b.setUsagePattern(QGLBuffer.DynamicDraw)
- self.assert_(b.create())
- self.assert_(b.bufferId() != 0)
- self.assert_(b.bind())
+ self.assertTrue(b.create())
+ self.assertTrue(b.bufferId() != 0)
+ self.assertTrue(b.bind())
data = QByteArray("12345")
b.allocate(data)
@@ -26,15 +26,15 @@ class QGLBufferTest(UsesQApplication):
m = b.map(QGLBuffer.ReadOnly)
if m:
- self.assertEqual(m, buffer(data.data()))
+ self.assertEqual(m, py3k.buffer(py3k.b(data.data())))
b.unmap()
m = b.map(QGLBuffer.ReadWrite)
- m[3] = 'A'
+ m[3] = py3k.b('A')
b.unmap()
result, rdata = b.read(3, 1)
self.assertTrue(result)
- self.assertEqual('A', rdata.data())
+ self.assertEqual(py3k.b('A'), rdata.data())
else:
print(" memory mapping is not possible in this OpenGL implementation.")
b.release()
diff --git a/tests/util/py3xfunctions.py b/tests/util/py3xfunctions.py
index 3b89867..4b8d801 100644
--- a/tests/util/py3xfunctions.py
+++ b/tests/util/py3xfunctions.py
@@ -1,4 +1,6 @@
def b(s):
+ if type(s) == bytes:
+ return s
return bytes(s, "UTF8")
def buffer_(s):
@@ -6,6 +8,8 @@ def buffer_(s):
return None
elif type(s) == str:
return bytes(s, "UTF8")
+ elif type(s) == bytes:
+ return s
else:
memoryview(s)