diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-02-12 13:20:06 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-02-12 13:20:06 (GMT) |
commit | af911861fdd317ae02ac14b9b1835929f99bc444 (patch) | |
tree | 8c2d24752cdd526b9ba7b91b07a0dead9e4b0121 /tests/auto/qgl/tst_qgl.cpp | |
parent | ac0de5f1d783a32b4d3d40bf28daa1b252764483 (diff) | |
parent | 95b320c17f4a0a505dd9da2362b0b7cc09ac64d8 (diff) | |
download | Qt-af911861fdd317ae02ac14b9b1835929f99bc444.zip Qt-af911861fdd317ae02ac14b9b1835929f99bc444.tar.gz Qt-af911861fdd317ae02ac14b9b1835929f99bc444.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Fix several bugs with GL texture cache
Compile fix for OpenGL ES.
Fix missing/outdated license headers.
Turned off subpixel AA text on surface with alpha in GL2 engine.
Add functional Graphics View benchmarks.
Make QCUPSSupport::printerHasPPD() clean up after itself.
document the slowness of QPixmap::hasAlpha()
Speed up custom bitmap brushes on X11 without Xrender support.
Diffstat (limited to 'tests/auto/qgl/tst_qgl.cpp')
-rw-r--r-- | tests/auto/qgl/tst_qgl.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index d37d727..2983af3 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -57,6 +57,8 @@ #ifdef QT_BUILD_INTERNAL #include <QtOpenGL/private/qgl_p.h> #include <QtGui/private/qpixmapdata_p.h> +#include <QtGui/private/qimage_p.h> +#include <QtGui/private/qimagepixmapcleanuphooks_p.h> #endif //TESTED_CLASS= @@ -1947,7 +1949,6 @@ void tst_QGL::qglContextDefaultBindTexture() #ifdef QT_BUILD_INTERNAL QGLWidget w; w.makeCurrent(); - QGLContext *ctx = const_cast<QGLContext*>(w.context()); QImage *boundImage = new QImage(256, 256, QImage::Format_RGB32); @@ -1955,29 +1956,36 @@ void tst_QGL::qglContextDefaultBindTexture() QPixmap *boundPixmap = new QPixmap(256, 256); boundPixmap->fill(Qt::red); - // Check that calling QGLContext::bindTexture with default args adds textures to cache int startCacheItemCount = QGLTextureCache::instance()->size(); + GLuint boundImageTextureId = ctx->bindTexture(*boundImage); GLuint boundPixmapTextureId = ctx->bindTexture(*boundPixmap); + + // Make sure the image & pixmap have been added to the cache: QCOMPARE(QGLTextureCache::instance()->size(), startCacheItemCount+2); + // Make sure the image & pixmap have the is_cached flag set: + QVERIFY(QImagePixmapCleanupHooks::isImageCached(*boundImage)); + QVERIFY(QImagePixmapCleanupHooks::isPixmapCached(*boundPixmap)); + // Make sure the texture IDs returned are valid: QCOMPARE((bool)glIsTexture(boundImageTextureId), GL_TRUE); QCOMPARE((bool)glIsTexture(boundPixmapTextureId), GL_TRUE); - // Make sure the textures are still there after we delete the image/pixmap: + // Make sure the textures are still valid after we delete the image/pixmap: + // Also check that although the textures are left intact, the cache entries are removed: delete boundImage; boundImage = 0; + QCOMPARE((bool)glIsTexture(boundImageTextureId), GL_TRUE); + QCOMPARE(QGLTextureCache::instance()->size(), startCacheItemCount+1); delete boundPixmap; boundPixmap = 0; - QCOMPARE(QGLTextureCache::instance()->size(), startCacheItemCount+2); + QCOMPARE((bool)glIsTexture(boundPixmapTextureId), GL_TRUE); + QCOMPARE(QGLTextureCache::instance()->size(), startCacheItemCount); - // Make sure the textures are deleted from the cache after calling QGLContext::deleteTexture() + // Finally, make sure QGLContext::deleteTexture deletes the texture IDs: ctx->deleteTexture(boundImageTextureId); ctx->deleteTexture(boundPixmapTextureId); - QCOMPARE(QGLTextureCache::instance()->size(), startCacheItemCount); - - // Finally, make sure QGLContext::deleteTexture also deleted the texture IDs: QCOMPARE((bool)glIsTexture(boundImageTextureId), GL_FALSE); QCOMPARE((bool)glIsTexture(boundPixmapTextureId), GL_FALSE); #endif |