summaryrefslogtreecommitdiffstats
path: root/tests/auto/qimagereader
diff options
context:
space:
mode:
authorHarald Fernengel <harald.fernengel@nokia.com>2010-11-02 13:52:28 (GMT)
committerHarald Fernengel <harald.fernengel@nokia.com>2010-11-02 13:52:35 (GMT)
commit85467f12bae6d748ba5643f4eb518bd63cd80352 (patch)
tree3c5cdc5fe6df60b9dd150c44bcce36b6a97a9805 /tests/auto/qimagereader
parentb375f4c0fd88c92e76c265198e55c7698c07a505 (diff)
downloadQt-85467f12bae6d748ba5643f4eb518bd63cd80352.zip
Qt-85467f12bae6d748ba5643f4eb518bd63cd80352.tar.gz
Qt-85467f12bae6d748ba5643f4eb518bd63cd80352.tar.bz2
use PlatformQuirks class for better testing
Diffstat (limited to 'tests/auto/qimagereader')
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp36
1 files changed, 21 insertions, 15 deletions
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index 4b4bdd6..d213e8e 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -55,6 +55,8 @@
#include <QTcpServer>
#include <QTimer>
+#include "../platformquirks.h"
+
#if defined(Q_OS_SYMBIAN)
# define SRCDIR "."
#endif
@@ -315,23 +317,27 @@ void tst_QImageReader::jpegRgbCmyk()
QImage image1(prefix + QLatin1String("YCbCr_cmyk.jpg"));
QImage image2(prefix + QLatin1String("YCbCr_cmyk.png"));
- // first, do some obvious tests
- QCOMPARE(image1.height(), image2.height());
- QCOMPARE(image1.width(), image2.width());
- QCOMPARE(image1.format(), image2.format());
- QCOMPARE(image1.format(), QImage::Format_RGB32);
-
- // compare all the pixels with a slack of 3. This ignores rounding errors in libjpeg/libpng
- for (int h = 0; h < image1.height(); ++h) {
- const uchar *s1 = image1.constScanLine(h);
- const uchar *s2 = image2.constScanLine(h);
- for (int w = 0; w < image1.width() * 4; ++w) {
- if (*s1 != *s2) {
- QVERIFY2(qAbs(*s1 - *s2) <= 3, qPrintable(QString("images differ in line %1, col %2 (image1: %3, image2: %4)").arg(h).arg(w).arg(*s1, 0, 16).arg(*s2, 0, 16)));
+ if (PlatformQuirks::isImageLoaderImprecise()) {
+ // first, do some obvious tests
+ QCOMPARE(image1.height(), image2.height());
+ QCOMPARE(image1.width(), image2.width());
+ QCOMPARE(image1.format(), image2.format());
+ QCOMPARE(image1.format(), QImage::Format_RGB32);
+
+ // compare all the pixels with a slack of 3. This ignores rounding errors in libjpeg/libpng
+ for (int h = 0; h < image1.height(); ++h) {
+ const uchar *s1 = image1.constScanLine(h);
+ const uchar *s2 = image2.constScanLine(h);
+ for (int w = 0; w < image1.width() * 4; ++w) {
+ if (*s1 != *s2) {
+ QVERIFY2(qAbs(*s1 - *s2) <= 3, qPrintable(QString("images differ in line %1, col %2 (image1: %3, image2: %4)").arg(h).arg(w).arg(*s1, 0, 16).arg(*s2, 0, 16)));
+ }
+ s1++;
+ s2++;
}
- s1++;
- s2++;
}
+ } else {
+ QCOMPARE(image1, image2);
}
}