summaryrefslogtreecommitdiffstats
path: root/tests/auto/unit
diff options
context:
space:
mode:
authorVaL Doroshchuk <valentyn.doroshchuk@qt.io>2020-02-05 12:17:17 +0100
committerVaL Doroshchuk <valentyn.doroshchuk@qt.io>2020-02-18 12:51:13 +0100
commit30034a140ca8aefa1986c9964ae1f30dcfef886e (patch)
tree797fbce757e150d48d00adbc0c1c0b85f7ec5bf1 /tests/auto/unit
parentb2606eed8fa46c3f81bb9b03ca10409a00ed134f (diff)
Remove usage of QGL* APIs
QOpenGL API should be used instead. Task-number: QTBUG-74409 Fixes: QTBUG-81902 Change-Id: I80d09cba79248451cf211eabd87651301ae18b63 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'tests/auto/unit')
-rw-r--r--tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp105
1 files changed, 51 insertions, 54 deletions
diff --git a/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp b/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp
index 6aaeab855..be5c85ab9 100644
--- a/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp
+++ b/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp
@@ -35,9 +35,9 @@
#include <qvideosurfaceformat.h>
#if QT_CONFIG(opengl)
-#include <QtOpenGL/qgl.h>
-#include <QtOpenGL/qglframebufferobject.h>
-#include <QtGui/qopenglfunctions.h>
+#include <QOpenGLContext>
+#include <QOpenGLFunctions>
+#include <QOpenGLWidget>
#endif
QT_USE_NAMESPACE
@@ -559,20 +559,19 @@ void tst_QPainterVideoSurface::presentOpaqueFrame()
void tst_QPainterVideoSurface::shaderType()
{
QPainterVideoSurface surface;
- QGLWidget widget;
- if (!widget.context()
- || !widget.context()->isValid()) {
- QSKIP("Platform does not support GLContext");
- }
-
+ QOpenGLWidget widget;
widget.show();
+
QVERIFY(QTest::qWaitForWindowExposed(&widget));
- widget.makeCurrent();
+
+ if (!widget.context() || !widget.context()->isValid())
+ QSKIP("Platform does not support OpenGLContext");
QCOMPARE(surface.shaderType(), QPainterVideoSurface::NoShaders);
QCOMPARE(surface.supportedShaderTypes(), QPainterVideoSurface::NoShaders);
- surface.setGLContext(const_cast<QGLContext *>(widget.context()));
+ widget.makeCurrent();
+ surface.updateGLContext();
QCOMPARE(surface.glContext(), widget.context());
{
@@ -612,12 +611,14 @@ void tst_QPainterVideoSurface::shaderType()
{
QSignalSpy spy(&surface, SIGNAL(supportedFormatsChanged()));
- surface.setGLContext(const_cast<QGLContext *>(widget.context()));
+ widget.makeCurrent();
+ surface.updateGLContext();
QCOMPARE(surface.glContext(), widget.context());
QCOMPARE(spy.count(), 0);
}
- surface.setGLContext(0);
+ widget.doneCurrent();
+ surface.updateGLContext();
QCOMPARE(surface.shaderType(), QPainterVideoSurface::NoShaders);
QCOMPARE(surface.supportedShaderTypes(), QPainterVideoSurface::NoShaders);
@@ -656,19 +657,18 @@ void tst_QPainterVideoSurface::shaderTypeStarted()
{
QFETCH(QPainterVideoSurface::ShaderType, shaderType);
- QGLWidget widget;
- if (!widget.context()
- || !widget.context()->isValid()) {
- QSKIP("Platform does not support GLContext");
- }
-
+ QOpenGLWidget widget;
widget.show();
+
QVERIFY(QTest::qWaitForWindowExposed(&widget));
- widget.makeCurrent();
+
+ if (!widget.context() || !widget.context()->isValid())
+ QSKIP("Platform does not support OpenGLContext");
QPainterVideoSurface surface;
- surface.setGLContext(const_cast<QGLContext *>(widget.context()));
+ widget.makeCurrent();
+ surface.updateGLContext();
if (!(surface.supportedShaderTypes() & shaderType))
QSKIP("Shader type unsupported on this platform");
@@ -712,7 +712,8 @@ void tst_QPainterVideoSurface::shaderTypeStarted()
QCOMPARE(surface.isActive(), true);
QCOMPARE(spy.count(), 0);
- surface.setGLContext(0);
+ widget.doneCurrent();
+ surface.updateGLContext();
QCOMPARE(surface.shaderType(), QPainterVideoSurface::NoShaders);
QCOMPARE(surface.isActive(), false);
QCOMPARE(spy.count(), 1);
@@ -904,18 +905,17 @@ void tst_QPainterVideoSurface::shaderSupportedFormat()
QFETCH(bool, supportedPixelFormat);
QFETCH(bool, supportedFormat);
- QGLWidget widget;
- if (!widget.context()
- || !widget.context()->isValid()) {
- QSKIP("Platform does not support GLContext");
- }
-
+ QOpenGLWidget widget;
widget.show();
+
QVERIFY(QTest::qWaitForWindowExposed(&widget));
- widget.makeCurrent();
+
+ if (!widget.context() || !widget.context()->isValid())
+ QSKIP("Platform does not support GLContext");
QPainterVideoSurface surface;
- surface.setGLContext(const_cast<QGLContext *>(widget.context()));
+ widget.makeCurrent();
+ surface.updateGLContext();
if (!(surface.supportedShaderTypes() & shaderType))
@@ -1026,18 +1026,17 @@ void tst_QPainterVideoSurface::shaderPresent()
QFETCH(int, bytesB);
QFETCH(int, bytesPerLineB);
- QGLWidget widget;
- if (!widget.context()
- || !widget.context()->isValid()) {
- QSKIP("Platform does not support GLContext");
- }
-
+ QOpenGLWidget widget;
widget.show();
+
QVERIFY(QTest::qWaitForWindowExposed(&widget));
- widget.makeCurrent();
+
+ if (!widget.context() || !widget.context()->isValid())
+ QSKIP("Platform does not support GLContext");
QPainterVideoSurface surface;
- surface.setGLContext(const_cast<QGLContext *>(widget.context()));
+ widget.makeCurrent();
+ surface.updateGLContext();
if (!(surface.supportedShaderTypes() & shaderType))
QSKIP("Shader type unsupported on this platform");
@@ -1163,18 +1162,17 @@ void tst_QPainterVideoSurface::shaderPresentOpaqueFrame()
{
QFETCH(QPainterVideoSurface::ShaderType, shaderType);
- QGLWidget widget;
- if (!widget.context()
- || !widget.context()->isValid()) {
- QSKIP("Platform does not support GLContext");
- }
-
+ QOpenGLWidget widget;
widget.show();
+
QVERIFY(QTest::qWaitForWindowExposed(&widget));
- widget.makeCurrent();
+
+ if (!widget.context() || !widget.context()->isValid())
+ QSKIP("Platform does not support GLContext");
QPainterVideoSurface surface;
- surface.setGLContext(const_cast<QGLContext *>(widget.context()));
+ widget.makeCurrent();
+ surface.updateGLContext();
if (!(surface.supportedShaderTypes() & shaderType))
QSKIP("Shader type unsupported on this platform");
@@ -1217,18 +1215,17 @@ void tst_QPainterVideoSurface::shaderPresentGLFrame()
{
QFETCH(QPainterVideoSurface::ShaderType, shaderType);
- QGLWidget widget;
- if (!widget.context()
- || !widget.context()->isValid()) {
- QSKIP("Platform does not support GLContext");
- }
-
+ QOpenGLWidget widget;
widget.show();
+
QVERIFY(QTest::qWaitForWindowExposed(&widget));
- widget.makeCurrent();
+
+ if (!widget.context() || !widget.context()->isValid())
+ QSKIP("Platform does not support GLContext");
QPainterVideoSurface surface;
- surface.setGLContext(const_cast<QGLContext *>(widget.context()));
+ widget.makeCurrent();
+ surface.updateGLContext();
if (!(surface.supportedShaderTypes() & shaderType))
QSKIP("Shader type unsupported on this platform");