diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-04-15 09:19:56 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-04-15 09:19:56 (GMT) |
commit | 21099dac569348a15df2d6a5a61015b5afa17097 (patch) | |
tree | b4ae338f206666b7f07e1f78278ad6d38609880b /tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | |
parent | f169ca1020886707b04101300e365d79f38a6332 (diff) | |
parent | 4e78de5a4281bd1c27a984b13887975798573aae (diff) | |
download | Qt-21099dac569348a15df2d6a5a61015b5afa17097.zip Qt-21099dac569348a15df2d6a5a61015b5afa17097.tar.gz Qt-21099dac569348a15df2d6a5a61015b5afa17097.tar.bz2 |
Merge commit 'origin/4.5'
Conflicts:
src/gui/graphicsview/qgraphicsitem.cpp
Diffstat (limited to 'tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp')
-rw-r--r-- | tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 91ed851..354d81a 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -245,6 +245,7 @@ private slots: void task139782_containsItemBoundingRect(); void task176178_itemIndexMethodBreaksSceneRect(); void task160653_selectionChanged(); + void task250680_childClip(); }; void tst_QGraphicsScene::initTestCase() @@ -3384,6 +3385,31 @@ void tst_QGraphicsScene::task160653_selectionChanged() QCOMPARE(spy.count(), 1); } +void tst_QGraphicsScene::task250680_childClip() +{ + QGraphicsRectItem *clipper = new QGraphicsRectItem; + clipper->setFlag(QGraphicsItem::ItemClipsChildrenToShape); + clipper->setPen(QPen(Qt::green)); + clipper->setRect(200, 200, 640, 480); + + QGraphicsRectItem *rect = new QGraphicsRectItem(clipper); + rect->setPen(QPen(Qt::red)); + rect->setBrush(QBrush(QColor(255, 0, 0, 75))); + rect->setPos(320, 240); + rect->setRect(-25, -25, 50, 50); + + QGraphicsScene scene; + scene.addItem(clipper); + + QPainterPath path; + path.addRect(-25, -25, 50, 50); + QCOMPARE(rect->clipPath(), path); + + QCOMPARE(scene.items(QRectF(320, 240, 5, 5)).size(), 2); + rect->rotate(45); + QCOMPARE(scene.items(QRectF(320, 240, 5, 5)).size(), 2); +} + void tst_QGraphicsScene::sorting_data() { QTest::addColumn<bool>("cache"); |