diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-07-20 00:16:27 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-07-20 00:16:27 (GMT) |
commit | 9a8ce2bd461f50fdcb7ac0ce658aac55a4bc4415 (patch) | |
tree | 27f91b1b5a2fa97ac30a0d7f178c5607988d2bf3 /tests/auto | |
parent | 17cc89e918a969d85d2b46631ee8743288c7586d (diff) | |
parent | 83d799a00dd4417f6d2efb02781e332f510dab6a (diff) | |
download | Qt-9a8ce2bd461f50fdcb7ac0ce658aac55a4bc4415.zip Qt-9a8ce2bd461f50fdcb7ac0ce658aac55a4bc4415.tar.gz Qt-9a8ce2bd461f50fdcb7ac0ce658aac55a4bc4415.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qimagereader/tst_qimagereader.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp index fe2a719..e9ef070 100644 --- a/tests/auto/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/qimagereader/tst_qimagereader.cpp @@ -315,7 +315,24 @@ void tst_QImageReader::jpegRgbCmyk() QImage image1(prefix + QLatin1String("YCbCr_cmyk.jpg")); QImage image2(prefix + QLatin1String("YCbCr_cmyk.png")); - QCOMPARE(image1, image2); + // 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++; + } + } } void tst_QImageReader::setScaledSize_data() |