summaryrefslogtreecommitdiff
path: root/tests/auto/qgraphicsview
diff options
context:
space:
mode:
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2010-02-24 11:11:21 +0100
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2010-02-24 14:22:56 +0100
commitbc3e50ec44fd9ae9a665826a40f325a61087568b (patch)
treed7000555477f8c54164faa1dadbec3a9e892fc54 /tests/auto/qgraphicsview
parent9be49ff72e7f34bd22b0375dccf142bd79f94fb6 (diff)
downloadqt4-tools-bc3e50ec44fd9ae9a665826a40f325a61087568b.tar.gz
GV: Update issues if drawItems() is overridden and IndirectPainting is used.
Problem was that the cached view bounding rect was never updated when overriding QGraphicsScene::drawItems or QGraphicsView::drawItems, without calling the base class implementation. The same for 'updateAll' boolean. We also have to make sure there are no unpolished items before we draw. Regression against 4.5. Auto-test included. Task-number: QTBUG-7880 Reviewed-by: yoann
Diffstat (limited to 'tests/auto/qgraphicsview')
-rw-r--r--tests/auto/qgraphicsview/tst_qgraphicsview.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
index 59bffeb67c..c77f76da57 100644
--- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
@@ -218,6 +218,7 @@ private slots:
void update();
void inputMethodSensitivity();
void inputContextReset();
+ void indirectPainting();
// task specific tests below me
void task172231_untransformableItems();
@@ -3799,6 +3800,31 @@ void tst_QGraphicsView::inputContextReset()
QCOMPARE(inputContext.resets, 0);
}
+void tst_QGraphicsView::indirectPainting()
+{
+ class MyScene : public QGraphicsScene
+ { public:
+ MyScene() : QGraphicsScene(), drawCount(0) {}
+ void drawItems(QPainter *, int, QGraphicsItem **, const QStyleOptionGraphicsItem *, QWidget *)
+ { ++drawCount; }
+ int drawCount;
+ };
+
+ MyScene scene;
+ QGraphicsItem *item = scene.addRect(0, 0, 50, 50);
+
+ QGraphicsView view(&scene);
+ view.setOptimizationFlag(QGraphicsView::IndirectPainting);
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+ QTest::qWait(100);
+
+ scene.drawCount = 0;
+ item->setPos(20, 20);
+ QApplication::processEvents();
+ QTRY_VERIFY(scene.drawCount > 0);
+}
+
void tst_QGraphicsView::task253415_reconnectUpdateSceneOnSceneChanged()
{
QGraphicsView view;