diff options
author | J-P Nurmi <jari-pekka.nurmi@nokia.com> | 2010-10-18 09:04:04 (GMT) |
---|---|---|
committer | Alexis Menard <alexis.menard@nokia.com> | 2010-10-18 09:04:04 (GMT) |
commit | 0d3c17fc672a762085f74d0e436ef842370729ec (patch) | |
tree | bb4327d4cda80a617b1a2b747ea557ba9f337d92 /tests/auto/qgraphicsitem | |
parent | 01e375731c839c9f2bd6ec94e1f2157340925efe (diff) | |
download | Qt-0d3c17fc672a762085f74d0e436ef842370729ec.zip Qt-0d3c17fc672a762085f74d0e436ef842370729ec.tar.gz Qt-0d3c17fc672a762085f74d0e436ef842370729ec.tar.bz2 |
Fixed QGraphicsItem to send ItemScenePositionHasChanged when appropriate
Task-number: QTBUG-13473
Merge-request: 812
Reviewed-by: Alexis Menard <alexis.menard@nokia.com>
Diffstat (limited to 'tests/auto/qgraphicsitem')
-rw-r--r-- | tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 2ddccd2..30199bb 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -466,6 +466,7 @@ private slots: void doNotMarkFullUpdateIfNotInScene(); void itemDiesDuringDraggingOperation(); void QTBUG_12112_focusItem(); + void QTBUG_13473_sceneposchange(); private: QList<QGraphicsItem *> paintedItems; @@ -11018,5 +11019,31 @@ void tst_QGraphicsItem::QTBUG_12112_focusItem() QVERIFY(item2->focusItem()); } +void tst_QGraphicsItem::QTBUG_13473_sceneposchange() +{ + ScenePosChangeTester* parent = new ScenePosChangeTester; + ScenePosChangeTester* child = new ScenePosChangeTester(parent); + + // parent's disabled ItemSendsGeometryChanges flag must not affect + // child's scene pos change notifications + parent->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false); + child->setFlag(QGraphicsItem::ItemSendsScenePositionChanges, true); + + QGraphicsScene scene; + scene.addItem(parent); + + // ignore uninteresting changes + parent->clear(); + child->clear(); + + // move + parent->moveBy(1.0, 1.0); + QCOMPARE(child->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 1); + + // transform + parent->setTransform(QTransform::fromScale(0.5, 0.5)); + QCOMPARE(child->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 2); +} + QTEST_MAIN(tst_QGraphicsItem) #include "tst_qgraphicsitem.moc" |