summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-08-19 14:00:57 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-08-24 11:45:05 (GMT)
commit7a5fa8af2d0c3329dd1962d6b053388a960f8305 (patch)
tree000ab5a75b849b95c34c80d305bf31530c51ac69 /tests
parent337f2562c5b3b5dc99f62b406f13021e502791e7 (diff)
downloadQt-7a5fa8af2d0c3329dd1962d6b053388a960f8305.zip
Qt-7a5fa8af2d0c3329dd1962d6b053388a960f8305.tar.gz
Qt-7a5fa8af2d0c3329dd1962d6b053388a960f8305.tar.bz2
QGraphicsView: Fix assert that may occurs if there are 'empty' item to draw, and changed() signal connected
Reviewed-by: bnilsen
Diffstat (limited to 'tests')
-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 903977c..7ee2a48 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"