diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2009-11-18 11:21:08 (GMT) |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2009-11-18 11:35:32 (GMT) |
commit | b6070e9a069219e4049fcf017d6a160b80bf37b7 (patch) | |
tree | 0e0c5a3164888b981d10e6f61ee78294383a3e58 /tests | |
parent | 1dacf83b2c957d320e65335cfc5f9abfda94b7c0 (diff) | |
download | Qt-b6070e9a069219e4049fcf017d6a160b80bf37b7.zip Qt-b6070e9a069219e4049fcf017d6a160b80bf37b7.tar.gz Qt-b6070e9a069219e4049fcf017d6a160b80bf37b7.tar.bz2 |
Crash when rendering a scene using DeviceCoordinateCache
The execution flow would allow the widget the scene would be rendered on to be
null. However this very widget was being used when using DeviceCoordinateCache
to get the desktop size. We now skip this optimisation when no widget is
given. Auto-test included.
Reviewed-by: bnilsen
Task-number: QTBUG-5904
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index a49c2c1..20d9eb8 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -276,6 +276,7 @@ private slots: void task176178_itemIndexMethodBreaksSceneRect(); void task160653_selectionChanged(); void task250680_childClip(); + void taskQTBUG_5904_crashWithDeviceCoordinateCache(); }; void tst_QGraphicsScene::initTestCase() @@ -4180,5 +4181,20 @@ void tst_QGraphicsScene::isActive() } +void tst_QGraphicsScene::taskQTBUG_5904_crashWithDeviceCoordinateCache() +{ + QGraphicsScene scene; + QGraphicsRectItem *rectItem = scene.addRect(QRectF(0, 0, 100, 200), QPen(Qt::black), QBrush(Qt::green)); + + rectItem->setCacheMode(QGraphicsItem::DeviceCoordinateCache); + + QPixmap pixmap(100,200); + QPainter painter(&pixmap); + painter.setRenderHint(QPainter::Antialiasing); + scene.render(&painter); + painter.end(); + // No crash, then it passed! +} + QTEST_MAIN(tst_QGraphicsScene) #include "tst_qgraphicsscene.moc" |