diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2010-12-09 13:21:26 (GMT) |
---|---|---|
committer | Samuel Rødal <samuel.rodal@nokia.com> | 2010-12-09 13:33:04 (GMT) |
commit | a23cab16dd4dd3505578d2747debaa28a21190ea (patch) | |
tree | 6acfb37f92388efcdd5b6b43a49315a668c38a63 /tests/auto | |
parent | 99938908456a422ebced06744deec6333546bf6b (diff) | |
download | Qt-a23cab16dd4dd3505578d2747debaa28a21190ea.zip Qt-a23cab16dd4dd3505578d2747debaa28a21190ea.tar.gz Qt-a23cab16dd4dd3505578d2747debaa28a21190ea.tar.bz2 |
Fixed DeviceCoordinateCache items when using QGraphicsScene::render().
Since viewRect is null, we shouldn't try to use the partialCacheExposure
path which intersects the viewRect with the device rect of the item.
Task-number: QTBUG-15977
Reviewed-by: Bjørn Erik Nilsen
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 6a2f849..588c476 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -288,6 +288,7 @@ private slots: void taskQT657_paintIntoCacheWithTransparentParts(); void taskQTBUG_7863_paintIntoCacheWithTransparentParts(); void taskQT_3674_doNotCrash(); + void taskQTBUG_15977_renderWithDeviceCoordinateCache(); }; void tst_QGraphicsScene::initTestCase() @@ -4629,5 +4630,27 @@ void tst_QGraphicsScene::zeroScale() QTRY_COMPARE(cl.changes.count(), 2); } +void tst_QGraphicsScene::taskQTBUG_15977_renderWithDeviceCoordinateCache() +{ + QGraphicsScene scene; + scene.setSceneRect(0, 0, 100, 100); + QGraphicsRectItem *rect = scene.addRect(0, 0, 100, 100); + rect->setPen(Qt::NoPen); + rect->setBrush(Qt::red); + rect->setCacheMode(QGraphicsItem::DeviceCoordinateCache); + + QImage image(100, 100, QImage::Format_RGB32); + QPainter p(&image); + scene.render(&p); + p.end(); + + QImage expected(100, 100, QImage::Format_RGB32); + p.begin(&expected); + p.fillRect(expected.rect(), Qt::red); + p.end(); + + QCOMPARE(image, expected); +} + QTEST_MAIN(tst_QGraphicsScene) #include "tst_qgraphicsscene.moc" |