summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicsscene
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-08-19 16:00:57 +0200
committerOlivier Goffart <olivier.goffart@nokia.com>2010-08-24 13:45:05 +0200
commit7a5fa8af2d0c3329dd1962d6b053388a960f8305 (patch)
tree000ab5a75b849b95c34c80d305bf31530c51ac69 /tests/auto/qgraphicsscene
parent337f2562c5b3b5dc99f62b406f13021e502791e7 (diff)
QGraphicsView: Fix assert that may occurs if there are 'empty' item to draw, and changed() signal connected
Reviewed-by: bnilsen
Diffstat (limited to 'tests/auto/qgraphicsscene')
-rw-r--r--tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
index 903977c577..7ee2a48163 100644
--- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -276,6 +276,7 @@ private slots:
void isActive();
void siblingIndexAlwaysValid();
void removeFullyTransparentItem();
+ void zeroScale();
// task specific tests below me
void task139710_bspTreeCrash();
@@ -4564,5 +4565,30 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts()
}
}
+void tst_QGraphicsScene::zeroScale()
+{
+ //should not crash
+ QGraphicsScene scene;
+ scene.setSceneRect(-100, -100, 100, 100);
+ QGraphicsView view(&scene);
+
+ ChangedListener cl;
+ connect(&scene, SIGNAL(changed(const QList<QRectF> &)), &cl, SLOT(changed(const QList<QRectF> &)));
+
+ QGraphicsRectItem *rect1 = new QGraphicsRectItem(0, 0, 0.0000001, 0.00000001);
+ scene.addItem(rect1);
+ rect1->setRotation(82);
+ rect1->setScale(0.00000001);
+
+ QApplication::processEvents();
+ QCOMPARE(cl.changes.count(), 1);
+ QGraphicsRectItem *rect2 = new QGraphicsRectItem(-0.0000001, -0.0000001, 0.0000001, 0.0000001);
+ rect2->setScale(0.00000001);
+ scene.addItem(rect2);
+ rect1->setPos(20,20);
+ QApplication::processEvents();
+ QCOMPARE(cl.changes.count(), 2);
+}
+
QTEST_MAIN(tst_QGraphicsScene)
#include "tst_qgraphicsscene.moc"