summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@nokia.com>2009-12-11 15:41:00 (GMT)
committerYoann Lopes <yoann.lopes@nokia.com>2009-12-11 15:41:00 (GMT)
commit6a1cff7c47e1f47161f765ba2f7094b55aaa13c5 (patch)
treeb08e01c0242a72d0ff44d8e33e34e19074df1e7d /tests/auto
parent9e5c5e2c68f3aefd60571551664936465dd04913 (diff)
downloadQt-6a1cff7c47e1f47161f765ba2f7094b55aaa13c5.zip
Qt-6a1cff7c47e1f47161f765ba2f7094b55aaa13c5.tar.gz
Qt-6a1cff7c47e1f47161f765ba2f7094b55aaa13c5.tar.bz2
Fixes Graphicsitem transformation problems when grouping/ungrouping.
New transformation properties added in 4.6, such as rotation or transformOriginPoint were not taken into account in addTogroup and removeFromGroup. Autotest and manual test included. Task-number: QTBUG-5071 Reviewed-by: bnilsen
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 3e7a2eb..a4931ab 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -318,6 +318,7 @@ private slots:
void childrenBoundingRect3();
void group();
void setGroup();
+ void setGroup2();
void nestedGroups();
void warpChildrenIntoGroup();
void removeFromGroup();
@@ -3345,6 +3346,35 @@ void tst_QGraphicsItem::setGroup()
QCOMPARE(rect->parentItem(), (QGraphicsItem *)0);
}
+void tst_QGraphicsItem::setGroup2()
+{
+ QGraphicsScene scene;
+ QGraphicsItemGroup group;
+ scene.addItem(&group);
+
+ QGraphicsRectItem *rect = scene.addRect(50,50,50,50,Qt::NoPen,Qt::black);
+ rect->setTransformOriginPoint(50,50);
+ rect->setRotation(45);
+ rect->setScale(1.5);
+ rect->translate(20,20);
+ group.translate(-30,-40);
+ group.setRotation(180);
+ group.setScale(0.5);
+
+ QTransform oldSceneTransform = rect->sceneTransform();
+ rect->setGroup(&group);
+ QCOMPARE(rect->sceneTransform(), oldSceneTransform);
+
+ group.setRotation(20);
+ group.setScale(2);
+ rect->setRotation(90);
+ rect->setScale(0.8);
+
+ oldSceneTransform = rect->sceneTransform();
+ rect->setGroup(0);
+ QCOMPARE(rect->sceneTransform(), oldSceneTransform);
+}
+
void tst_QGraphicsItem::nestedGroups()
{
QGraphicsItemGroup *group1 = new QGraphicsItemGroup;