diff options
author | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-11-06 14:18:13 (GMT) |
---|---|---|
committer | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-11-06 14:50:54 (GMT) |
commit | 18a3daf86118bd23a28f05fcf1721969c4ba491b (patch) | |
tree | 100fcd1c367b5cdc5fcd7840ea4f1c0593e64759 /tests | |
parent | c92670dc8b2e5cf727c33943dde0755c17d0dac2 (diff) | |
download | Qt-18a3daf86118bd23a28f05fcf1721969c4ba491b.zip Qt-18a3daf86118bd23a28f05fcf1721969c4ba491b.tar.gz Qt-18a3daf86118bd23a28f05fcf1721969c4ba491b.tar.bz2 |
Make qgl autotests more stable & passing in test farm
There were problems with false-failures due to the test farm's GL
implementation having off-by-one pixel errors. To fix this, we don't
compare every pixel but rather sample pixels in a grid pattern which
avoids boundries.
Reviewed-By: Samuel
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qgl/tst_qgl.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index 6286c30..2c60eb2 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -939,8 +939,8 @@ public: // This test only ensures it's possible to paint onto a QGLWidget. Full // paint engine feature testing is way out of scope! + p.fillRect(-1, -1, width()+2, height()+2, Qt::red); - p.fillRect(0, 0, width(), height(), Qt::red); // No p.end() or swap buffers, should be done automatically } @@ -1159,11 +1159,11 @@ protected: QPainter fboPainter; fboPainterBeginOk = fboPainter.begin(fbo); - fboPainter.fillRect(0, 0, 128, 128, Qt::red); + fboPainter.fillRect(-1, -1, 130, 130, Qt::red); fboPainter.end(); fboImage = fbo->toImage(); - widgetPainter.fillRect(rect(), Qt::blue); + widgetPainter.fillRect(-1, -1, width()+2, width()+2, Qt::blue); delete fbo; } @@ -1577,7 +1577,13 @@ void tst_QGL::replaceClipping() const QImage widgetFB = glw.grabFrameBuffer(false).convertToFormat(QImage::Format_RGB32); - QCOMPARE(widgetFB, reference); + // Sample pixels in a grid pattern which avoids false failures due to + // off-by-one pixel errors on some buggy GL implementations + for (int x = 25; x < reference.width(); x += 50) { + for (int y = 25; y < reference.width(); y += 50) { + QFUZZY_COMPARE_PIXELS(widgetFB.pixel(x, y), reference.pixel(x, y)); + } + } } class ClipTestGLWidget : public QGLWidget @@ -1585,7 +1591,7 @@ class ClipTestGLWidget : public QGLWidget public: void paint(QPainter *painter) { - painter->fillRect(rect(), Qt::white); + painter->fillRect(-1, -1, width()+2, height()+2, Qt::white); painter->setClipRect(10, 10, width()-20, height()-20); painter->fillRect(rect(), Qt::cyan); @@ -1702,7 +1708,13 @@ void tst_QGL::clipTest() const QImage widgetFB = glw.grabFrameBuffer(false).convertToFormat(QImage::Format_RGB32); - QCOMPARE(widgetFB, reference); + // Sample pixels in a grid pattern which avoids false failures due to + // off-by-one pixel errors on some buggy GL implementations + for (int x = 2; x < reference.width(); x += 5) { + for (int y = 2; y < reference.width(); y += 5) { + QFUZZY_COMPARE_PIXELS(widgetFB.pixel(x, y), reference.pixel(x, y)); + } + } } void tst_QGL::destroyFBOAfterContext() |