From 17511e199f82ffb9e245fbed3872c9c73bcf2a00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 12 Sep 2011 13:00:30 +0200 Subject: [PATCH] Fixed auto-test failure in tst_QOpenGL. QOpenGLFramebufferObject::height() was returning the width... Change-Id: I521c2df02e00015998dc31a74481113af26e1ba6 Reviewed-on: http://codereview.qt-project.org/4663 Reviewed-by: Qt Sanity Bot Reviewed-by: Gunnar Sletta --- src/gui/opengl/qopenglframebufferobject.h | 2 +- tests/auto/qopengl/tst_qopengl.cpp | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/gui/opengl/qopenglframebufferobject.h b/src/gui/opengl/qopenglframebufferobject.h index e25ec6b15cd..17ee74aa94b 100644 --- a/src/gui/opengl/qopenglframebufferobject.h +++ b/src/gui/opengl/qopenglframebufferobject.h @@ -93,7 +93,7 @@ public: bool release(); int width() const { return size().width(); } - int height() const { return size().width(); } + int height() const { return size().height(); } GLuint texture() const; QSize size() const; diff --git a/tests/auto/qopengl/tst_qopengl.cpp b/tests/auto/qopengl/tst_qopengl.cpp index 02c6c7e9865..2f4bb0cad90 100644 --- a/tests/auto/qopengl/tst_qopengl.cpp +++ b/tests/auto/qopengl/tst_qopengl.cpp @@ -338,24 +338,23 @@ void tst_QOpenGL::fboRendering() fboFormat.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil); // Uncomplicate things by using NPOT: - QOpenGLFramebufferObject *fbo = new QOpenGLFramebufferObject(256, 128, fboFormat); + QOpenGLFramebufferObject fbo(256, 128, fboFormat); - if (fbo->attachment() != QOpenGLFramebufferObject::CombinedDepthStencil) { - delete fbo; + if (fbo.attachment() != QOpenGLFramebufferObject::CombinedDepthStencil) QSKIP("FBOs missing combined depth~stencil support", SkipSingle); - } + + fbo.bind(); QPainter fboPainter; - QOpenGLPaintDevice device(fbo->width(), fbo->height()); + QOpenGLPaintDevice device(fbo.width(), fbo.height()); bool painterBegun = fboPainter.begin(&device); QVERIFY(painterBegun); - qt_opengl_draw_test_pattern(&fboPainter, fbo->width(), fbo->height()); + qt_opengl_draw_test_pattern(&fboPainter, fbo.width(), fbo.height()); fboPainter.end(); - QImage fb = fbo->toImage().convertToFormat(QImage::Format_RGB32); - delete fbo; + QImage fb = fbo.toImage().convertToFormat(QImage::Format_RGB32); qt_opengl_check_test_pattern(fb); }