diff options
Diffstat (limited to 'sources/pyside6/tests/QtOpenGL')
-rw-r--r-- | sources/pyside6/tests/QtOpenGL/qopenglbuffer_test.py | 3 | ||||
-rw-r--r-- | sources/pyside6/tests/QtOpenGL/qopenglwindow_test.py | 15 |
2 files changed, 12 insertions, 6 deletions
diff --git a/sources/pyside6/tests/QtOpenGL/qopenglbuffer_test.py b/sources/pyside6/tests/QtOpenGL/qopenglbuffer_test.py index 7567000c5..98e0a4991 100644 --- a/sources/pyside6/tests/QtOpenGL/qopenglbuffer_test.py +++ b/sources/pyside6/tests/QtOpenGL/qopenglbuffer_test.py @@ -42,6 +42,7 @@ from helper.usesqapplication import UsesQApplication from PySide6.QtGui import QOffscreenSurface, QOpenGLContext, QSurface, QWindow from PySide6.QtOpenGL import QOpenGLBuffer + def createSurface(surfaceClass): if surfaceClass == QSurface.Window: window = QWindow() @@ -68,6 +69,7 @@ def createSurface(surfaceClass): return offscreenSurface return 0 + class QOpenGLBufferTest(UsesQApplication): def testBufferCreate(self): surface = createSurface(QSurface.Window) @@ -95,5 +97,6 @@ class QOpenGLBufferTest(UsesQApplication): ctx.doneCurrent() + if __name__ == '__main__': unittest.main() diff --git a/sources/pyside6/tests/QtOpenGL/qopenglwindow_test.py b/sources/pyside6/tests/QtOpenGL/qopenglwindow_test.py index 11720303b..87b0d7e49 100644 --- a/sources/pyside6/tests/QtOpenGL/qopenglwindow_test.py +++ b/sources/pyside6/tests/QtOpenGL/qopenglwindow_test.py @@ -51,6 +51,7 @@ except ImportError: print("Skipping test due to missing OpenGL module") sys.exit(0) + class OpenGLWindow(QOpenGLWindow): def __init__(self): super().__init__() @@ -72,15 +73,15 @@ class OpenGLWindow(QOpenGLWindow): self.m_texture = QOpenGLTexture(image) def paintGL(self): - GL.glMatrixMode(GL.GL_MODELVIEW); - GL.glLoadIdentity(); + GL.glMatrixMode(GL.GL_MODELVIEW) + GL.glLoadIdentity() - GL.glMatrixMode(GL.GL_PROJECTION); - GL.glLoadIdentity(); - GL.glOrtho(0, 1, 1, 0, -1, 1); + GL.glMatrixMode(GL.GL_PROJECTION) + GL.glLoadIdentity() + GL.glOrtho(0, 1, 1, 0, -1, 1) self.m_functions.glClear(GL.GL_COLOR_BUFFER_BIT) - self.m_functions.glEnable(GL.GL_TEXTURE_2D); + self.m_functions.glEnable(GL.GL_TEXTURE_2D) self.m_texture.bind() d = 0.5 @@ -99,6 +100,7 @@ class OpenGLWindow(QOpenGLWindow): def resizeGL(self, w, h): self.m_functions.glViewport(0, 0, self.width(), self.height()) + class QOpenGLWindowTest(UsesQApplication): # On macOS, glClear(), glViewport() are rejected due to GLbitfield/GLint not being resolved properly def test(self): @@ -108,5 +110,6 @@ class QOpenGLWindowTest(UsesQApplication): QTimer.singleShot(100, openGlWindow.close) self.app.exec_() + if __name__ == '__main__': unittest.main() |