summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicsscene
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2009-11-18 12:21:08 +0100
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2009-11-18 12:35:32 +0100
commitb6070e9a069219e4049fcf017d6a160b80bf37b7 (patch)
tree0e0c5a3164888b981d10e6f61ee78294383a3e58 /tests/auto/qgraphicsscene
parent1dacf83b2c957d320e65335cfc5f9abfda94b7c0 (diff)
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/auto/qgraphicsscene')
-rw-r--r--tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
index a49c2c1379..20d9eb8624 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"