diff options
author | Trond Kjernåsen <trond.kjernasen@nokia.com> | 2010-07-02 13:38:07 (GMT) |
---|---|---|
committer | Trond Kjernåsen <trond.kjernasen@nokia.com> | 2010-07-02 13:38:07 (GMT) |
commit | 449cbdfd1b8523e721d8b86e49647495b67005e4 (patch) | |
tree | 110ccb5e37ceb2077e6da1022ec95878a5aebf97 | |
parent | e11af338a0d0e96a8100d0e78cc42e67e1447864 (diff) | |
download | Qt-449cbdfd1b8523e721d8b86e49647495b67005e4.zip Qt-449cbdfd1b8523e721d8b86e49647495b67005e4.tar.gz Qt-449cbdfd1b8523e721d8b86e49647495b67005e4.tar.bz2 |
Fix the tests for the internal GL resource system.
-rw-r--r-- | src/opengl/qgl_p.h | 4 | ||||
-rw-r--r-- | tests/auto/qgl/tst_qgl.cpp | 26 |
2 files changed, 11 insertions, 19 deletions
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 3be30de..fd6b7f0 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -612,7 +612,7 @@ inline GLenum qt_gl_preferredTextureTarget() /* Base for resources that are shared in a context group. */ -class QGLContextGroupResourceBase +class Q_OPENGL_EXPORT QGLContextGroupResourceBase { public: QGLContextGroupResourceBase(); @@ -673,7 +673,7 @@ protected: /* Base for resources that are context specific. */ -class QGLContextResourceBase +class Q_OPENGL_EXPORT QGLContextResourceBase { public: virtual ~QGLContextResourceBase() { diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index 8ee494f..c05f730 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -1871,11 +1871,10 @@ void tst_QGL::destroyFBOAfterContext() #ifdef QT_BUILD_INTERNAL -class tst_QGLResource : public QObject +class tst_QGLResource { - Q_OBJECT public: - tst_QGLResource(QObject *parent = 0) : QObject(parent) {} + tst_QGLResource(const QGLContext * = 0) {} ~tst_QGLResource() { ++deletions; } static int deletions; @@ -1883,12 +1882,7 @@ public: int tst_QGLResource::deletions = 0; -static void qt_shared_test_free(void *data) -{ - delete reinterpret_cast<tst_QGLResource *>(data); -} - -Q_GLOBAL_STATIC_WITH_ARGS(QGLContextResource, qt_shared_test, (qt_shared_test_free)) +Q_GLOBAL_STATIC(QGLContextGroupResource<tst_QGLResource>, qt_shared_test) #endif @@ -1908,10 +1902,9 @@ void tst_QGL::shareRegister() guard.setId(3); QVERIFY(guard.id() == 3); - // Add a resource to the first context. - tst_QGLResource *res1 = new tst_QGLResource(); - QVERIFY(!qt_shared_test()->value(glw1->context())); - qt_shared_test()->insert(glw1->context(), res1); + // Request a tst_QGLResource object for the first context. + tst_QGLResource *res1 = qt_shared_test()->value(glw1->context()); + QVERIFY(res1); QVERIFY(qt_shared_test()->value(glw1->context()) == res1); // Create another context that shares with the first. @@ -1950,10 +1943,9 @@ void tst_QGL::shareRegister() QGLSharedResourceGuard guard3(glw3->context()); guard3.setId(5); - // Add a resource to the third context. - tst_QGLResource *res3 = new tst_QGLResource(); - QVERIFY(!qt_shared_test()->value(glw3->context())); - qt_shared_test()->insert(glw3->context(), res3); + // Request a resource to the third context. + tst_QGLResource *res3 = qt_shared_test()->value(glw3->context()); + QVERIFY(res3); QVERIFY(qt_shared_test()->value(glw1->context()) == res1); QVERIFY(qt_shared_test()->value(glw2->context()) == res1); QVERIFY(qt_shared_test()->value(glw3->context()) == res3); |