summaryrefslogtreecommitdiffstats
path: root/tests/auto/qpainter
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-06-19 10:45:47 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-06-22 08:58:43 (GMT)
commit18940f4953bfdc08b7ee8cfe9067ead6282b06a4 (patch)
treea21958ce0ee16cd99d0975c00eafd456cecb4df3 /tests/auto/qpainter
parentfe48ca11f7da7200c052a7825ad4d46319b13cc5 (diff)
downloadQt-18940f4953bfdc08b7ee8cfe9067ead6282b06a4.zip
Qt-18940f4953bfdc08b7ee8cfe9067ead6282b06a4.tar.gz
Qt-18940f4953bfdc08b7ee8cfe9067ead6282b06a4.tar.bz2
Fixed rounding bug in raster paint engine rect / image drawing.
Change 855aa89e0ba99f8a0f75d7b31930bab2cefb93f8 incorrectly changed toNormalizedFillRect to use int truncation instead of qRound. This fixes the autotest failure in tst_QPainter::drawRect2 as well. Reviewed-by: Trond
Diffstat (limited to 'tests/auto/qpainter')
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp
index 7e42da8..5e5bd39 100644
--- a/tests/auto/qpainter/tst_qpainter.cpp
+++ b/tests/auto/qpainter/tst_qpainter.cpp
@@ -202,6 +202,7 @@ private slots:
void drawImage_task217400_data();
void drawImage_task217400();
+ void drawImage_1x1();
void drawRect_task215378();
void drawRect_task247505();
@@ -4237,5 +4238,25 @@ void tst_QPainter::emptyClip()
p.fillPath(path, Qt::green);
}
+void tst_QPainter::drawImage_1x1()
+{
+ QImage source(1, 1, QImage::Format_ARGB32_Premultiplied);
+ source.fill(0xffffffff);
+
+ QImage img(32, 32, QImage::Format_ARGB32_Premultiplied);
+ img.fill(0xff000000);
+ QPainter p(&img);
+ p.drawImage(QRectF(0.9, 0.9, 32, 32), source);
+ p.end();
+
+ QImage expected = img;
+ expected.fill(0xff000000);
+ p.begin(&expected);
+ p.fillRect(1, 1, 31, 31, Qt::white);
+ p.end();
+
+ QCOMPARE(img, expected);
+}
+
QTEST_MAIN(tst_QPainter)
#include "tst_qpainter.moc"