summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicseffect
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2010-03-02 12:49:33 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2010-03-02 14:29:46 (GMT)
commitfd30cc9fabe6fc023fbca5b93cfdb116fe194514 (patch)
tree3e38dd89ccd3fcd1cd8087e193388e47b9adbac5 /tests/auto/qgraphicseffect
parentb6e312df6cc087dbf45becb91bd43b35913e3684 (diff)
downloadQt-fd30cc9fabe6fc023fbca5b93cfdb116fe194514.zip
Qt-fd30cc9fabe6fc023fbca5b93cfdb116fe194514.tar.gz
Qt-fd30cc9fabe6fc023fbca5b93cfdb116fe194514.tar.bz2
Fixed rendering bugs when scrolling graphics items with drop shadows.
We can't clip source pixmaps to the device rect, as there's no way of knowing which parts of the source pixmap are needed for the part of the graphics effect that's unclipped. Reviewed-by: Bjørn Erik Nilsen
Diffstat (limited to 'tests/auto/qgraphicseffect')
-rw-r--r--tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
index 795431b..1007d61 100644
--- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
+++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
@@ -72,6 +72,7 @@ private slots:
void drawPixmapItem();
void deviceCoordinateTranslateCaching();
void inheritOpacity();
+ void dropShadowClipping();
};
void tst_QGraphicsEffect::initTestCase()
@@ -590,6 +591,28 @@ void tst_QGraphicsEffect::inheritOpacity()
QTRY_VERIFY(item->numRepaints > numRepaints);
}
+void tst_QGraphicsEffect::dropShadowClipping()
+{
+ QImage img(128, 128, QImage::Format_ARGB32_Premultiplied);
+ img.fill(0xffffffff);
+
+ QGraphicsScene scene;
+ QGraphicsRectItem *item = new QGraphicsRectItem(-5, -500, 10, 1000);
+ item->setGraphicsEffect(new QGraphicsDropShadowEffect);
+ item->setPen(Qt::NoPen);
+ item->setBrush(Qt::red);
+
+ scene.addItem(item);
+
+ QPainter p(&img);
+ scene.render(&p, img.rect(), QRect(-64, -64, 128, 128));
+ p.end();
+
+ for (int y = 1; y < img.height(); ++y)
+ for (int x = 0; x < img.width(); ++x)
+ QCOMPARE(img.pixel(x, y), img.pixel(x, y-1));
+}
+
QTEST_MAIN(tst_QGraphicsEffect)
#include "tst_qgraphicseffect.moc"