summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgl
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-02-17 21:55:18 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-02-17 21:55:18 (GMT)
commit9eacc56619ce471a9777f88c89f64ca95cd6ae63 (patch)
treeb52b46a26a04889145a30339da28e5aa99756b1c /tests/auto/qgl
parentfd3f9dd0f31efeea3aa0ec28b54c70d85712c7ba (diff)
parent54b20c491f7e182f6b98f65b7e9e8e68286d6109 (diff)
downloadQt-9eacc56619ce471a9777f88c89f64ca95cd6ae63.zip
Qt-9eacc56619ce471a9777f88c89f64ca95cd6ae63.tar.gz
Qt-9eacc56619ce471a9777f88c89f64ca95cd6ae63.tar.bz2
Merge branch 'qt-master-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration into master-integration
* 'qt-master-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration: (249 commits) Fixed autotest failure in tst_QGraphicsScene::render on Maemo. Changed function names in audio input example to clarify meaning Tidied up debug output in audio input example Removed redundant strings from audio input example Cleaned up memory management in audio input example Changed variable names in audio input example to match Qt code style Made level calculation in audio input example work for all formats Removed unused variable from audio input example Update suspend/resume button label in audio input example Changed function names in audio output example to clarify meaning Cleaned up implementation of audio output example Tidied up debug output in audio output example Removed redundant strings from audio output example Cleaned up memory management in audio output example Changed variable names in audio output example to match Qt code style Made data generation in audio output example work for all formats Update suspend/resume button label in audio output example Added missing override in audio output example QLocalSocket::isValid on Windows must check for broken connection Fix an issue with the error signal in a callWithCallback not being ...
Diffstat (limited to 'tests/auto/qgl')
-rw-r--r--tests/auto/qgl/tst_qgl.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp
index eeccc9a..1bf7850 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=
@@ -1986,7 +1988,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);
@@ -1994,29 +1995,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