summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgl
diff options
context:
space:
mode:
authorTrond Kjernåsen <trond.kjernasen@nokia.com>2010-07-02 15:38:07 +0200
committerTrond Kjernåsen <trond.kjernasen@nokia.com>2010-07-02 15:38:07 +0200
commit449cbdfd1b8523e721d8b86e49647495b67005e4 (patch)
tree110ccb5e37ceb2077e6da1022ec95878a5aebf97 /tests/auto/qgl
parente11af338a0d0e96a8100d0e78cc42e67e1447864 (diff)
Fix the tests for the internal GL resource system.
Diffstat (limited to 'tests/auto/qgl')
-rw-r--r--tests/auto/qgl/tst_qgl.cpp26
1 files changed, 9 insertions, 17 deletions
diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp
index 8ee494f08e..c05f730135 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);