summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-08-18 15:00:34 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-09-08 10:18:45 (GMT)
commit4feb4019cfc144cef4cd9177d52e52dee9ebdf32 (patch)
treebb9bce281070cc4296767fe9d75d0d19458299f5 /tests
parent7413c83bc6ea02e9f159d77d9f71a5c39d9bb0ef (diff)
downloadQt-4feb4019cfc144cef4cd9177d52e52dee9ebdf32.zip
Qt-4feb4019cfc144cef4cd9177d52e52dee9ebdf32.tar.gz
Qt-4feb4019cfc144cef4cd9177d52e52dee9ebdf32.tar.bz2
Fixed bug in drawImage() when fall-back code path is used.
We need to floor instead of round to prevent rectangles that are on the edge from being shifted one pixel down / right. Task-number: 258776 Reviewed-by: Kim
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp
index a105bc5..e77d133 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_task258776();
void drawRect_task215378();
void drawRect_task247505();
@@ -3507,6 +3508,31 @@ void tst_QPainter::drawImage_task217400()
}
}
+void tst_QPainter::drawImage_task258776()
+{
+ QImage src(16, 16, QImage::Format_RGB888);
+ QImage dest(33, 33, QImage::Format_RGB888);
+ src.fill(0x00ff00);
+ dest.fill(0x0000ff);
+
+ QPainter painter(&dest);
+ painter.drawImage(QRectF(0.499, 0.499, 32, 32), src, QRectF(0, 0, 16, 16));
+ painter.end();
+
+ QImage expected(33, 33, QImage::Format_RGB32);
+ expected.fill(0xff0000);
+
+ painter.begin(&expected);
+ painter.drawImage(QRectF(0, 0, 32, 32), src);
+ painter.end();
+
+ dest = dest.convertToFormat(QImage::Format_RGB32);
+
+ dest.save("dest.png");
+ expected.save("expected.png");
+ QCOMPARE(dest, expected);
+}
+
void tst_QPainter::clipRectSaveRestore()
{
QImage img(64, 64, QImage::Format_ARGB32_Premultiplied);