summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-08-31 08:40:28 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-08-31 08:40:28 (GMT)
commit69d43435f241f0d654b1a3eecdfdfc5140f6beac (patch)
treeb552389385cd5b3c627280ee1488bab81939106d /tests
parentcf28f6cacf59d434072656af05466541ba69e8ae (diff)
parent1a72dd3a1c8f66e31ce4102b2d3e7e5cff4817f8 (diff)
downloadQt-69d43435f241f0d654b1a3eecdfdfc5140f6beac.zip
Qt-69d43435f241f0d654b1a3eecdfdfc5140f6beac.tar.gz
Qt-69d43435f241f0d654b1a3eecdfdfc5140f6beac.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Make tst_image a little bit more tollerent to rounding errors Clear the QGLWindowSurface in ::beginPaint when needed. Made QT_GL_SWAPBUFFER_PRESERVE=1 with the GL graphics system work. Fix QStaticText with OpenGL1 engine tst_qimage: backport fix of commit 0d7e683 into 4.7 qdrawhelper: backport the optimisations in fetchTransformBilinear from master to 4.7
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qimage/tst_qimage.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp
index 49514dc..ec0ecec 100644
--- a/tests/auto/qimage/tst_qimage.cpp
+++ b/tests/auto/qimage/tst_qimage.cpp
@@ -1451,11 +1451,6 @@ static inline int rand8()
return int(256. * (qrand() / (RAND_MAX + 1.0)));
}
-static inline bool compare(int a, int b, int tolerance)
-{
- return qAbs(a - b) <= tolerance;
-}
-
// compares img.scale against the bilinear filtering used by QPainter
void tst_QImage::smoothScale3()
{
@@ -1483,6 +1478,7 @@ void tst_QImage::smoothScale3()
p.scale(scales[i], scales[i]);
p.drawImage(0, 0, img);
p.end();
+ int err = 0;
for (int y = 0; y < a.height(); ++y) {
for (int x = 0; x < a.width(); ++x) {
@@ -1490,11 +1486,15 @@ void tst_QImage::smoothScale3()
QRgb cb = b.pixel(x, y);
// tolerate a little bit of rounding errors
- QVERIFY(compare(qRed(ca), qRed(cb), 3));
- QVERIFY(compare(qGreen(ca), qGreen(cb), 3));
- QVERIFY(compare(qBlue(ca), qBlue(cb), 3));
+ bool r = true;
+ r &= qAbs(qRed(ca) - qRed(cb)) <= 18;
+ r &= qAbs(qGreen(ca) - qGreen(cb)) <= 18;
+ r &= qAbs(qBlue(ca) - qBlue(cb)) <= 18;
+ if (!r)
+ err++;
}
}
+ QCOMPARE(err, 0);
}
}