tests/auto/qpainter/tst_qpainter.cpp
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
child 37 758a864f9613
--- a/tests/auto/qpainter/tst_qpainter.cpp	Tue Jul 06 15:10:48 2010 +0300
+++ b/tests/auto/qpainter/tst_qpainter.cpp	Wed Aug 18 10:37:55 2010 +0300
@@ -2648,12 +2648,16 @@
     p.drawImage(imageRect, src, imageRect);
     p.end();
 
-    QImage expected(imageSize, destFormat);
-    p.begin(&expected);
-    p.fillRect(imageRect, QColor(127, 127, 127));
-    p.end();
-
-    QCOMPARE(dest, expected);
+    QImage actual = dest.convertToFormat(QImage::Format_RGB32);
+
+    for (int y = 0; y < actual.height(); ++y) {
+        QRgb *p = (QRgb *)actual.scanLine(y);
+        for (int x = 0; x < actual.width(); ++x) {
+            QVERIFY(qAbs(qRed(p[x]) - 127) <= 0xf);
+            QVERIFY(qAbs(qGreen(p[x]) - 127) <= 0xf);
+            QVERIFY(qAbs(qBlue(p[x]) - 127) <= 0xf);
+        }
+    }
 }
 
 void tst_QPainter::drawhelper_blend_untransformed_data()