summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-12-10 11:52:10 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-12-10 12:39:14 (GMT)
commit6db96dcd4acccbc13161f85adf3164907b7b5cae (patch)
treeba8d688c35ea64730a50798730ba0993fe23df4a /tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
parentf22916fe55547f530f31df56e8e49462899688a0 (diff)
downloadQt-6db96dcd4acccbc13161f85adf3164907b7b5cae.zip
Qt-6db96dcd4acccbc13161f85adf3164907b7b5cae.tar.gz
Qt-6db96dcd4acccbc13161f85adf3164907b7b5cae.tar.bz2
Fix redraw bugs when using graphics effects in device coordinate mode.
QGraphicsEffect::boundingRectFor() needs the source bounding rect in device coordinates. This patch fixes the documentation to reflect this, and fixes some internal usage of boundingRectFor() to ensure it always gets the device rect of the source. Task-number: QTBUG-5918 Reviewed-by: Bjørn Erik Nilsen
Diffstat (limited to 'tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp')
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 6266933..3e7a2eb 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -233,6 +233,7 @@ public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
hints = painter->renderHints();
+ painter->setBrush(brush);
painter->drawRect(boundingRect());
++repaints;
}
@@ -247,6 +248,7 @@ public:
QPainter::RenderHints hints;
int repaints;
QRectF br;
+ QBrush brush;
};
class tst_QGraphicsItem : public QObject
@@ -7646,17 +7648,20 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem()
EventTester *item1 = new EventTester;
item1->br = itemBoundingRect;
item1->setPos(-200, -200);
+ item1->brush = Qt::red;
EventTester *item2 = new EventTester;
item2->br = itemBoundingRect;
item2->setFlag(QGraphicsItem::ItemIgnoresTransformations);
item2->setParentItem(item1);
item2->setPos(200, 200);
+ item2->brush = Qt::green;
EventTester *item3 = new EventTester;
item3->br = itemBoundingRect;
item3->setParentItem(item2);
item3->setPos(80, 80);
+ item3->brush = Qt::blue;
scene.addItem(item1);
QTest::qWait(100);
@@ -7671,8 +7676,8 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem()
item1->setGraphicsEffect(shadow);
QTest::qWait(50);
- // Make sure all items are repainted.
- QCOMPARE(item1->repaints, 1);
+ // Make sure all visible items are repainted.
+ QCOMPARE(item1->repaints, 0);
QCOMPARE(item2->repaints, 1);
QCOMPARE(item3->repaints, 1);