diff options
author | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2010-02-03 18:39:17 (GMT) |
---|---|---|
committer | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2010-02-03 19:00:36 (GMT) |
commit | dda8a57c085216db609f822837c50bae38006b4e (patch) | |
tree | 94b030b5b8530a70ffd8ca1313ada2599f6de227 /tests | |
parent | 1b8c6049af9f20ac3df5469dd18d231da6aebfcd (diff) | |
download | Qt-dda8a57c085216db609f822837c50bae38006b4e.zip Qt-dda8a57c085216db609f822837c50bae38006b4e.tar.gz Qt-dda8a57c085216db609f822837c50bae38006b4e.tar.bz2 |
QGraphicsWidget is painted twice on the first show.
We want to discard all update requests when we there's a full update
pending. The problem was that 'updateAll' was reset too early causing
update requests to fall through. To prevent this from happening we
reset 'updateAll' right before the items are actually painted.
Auto-test included.
Task-number: QTBUG-6956
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index d3132fe..526486e 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -164,6 +164,7 @@ private slots: void polishEvent(); void polishEvent2(); void initialShow(); + void initialShow2(); // Task fixes void task236127_bspTreeIndexFails(); @@ -2881,6 +2882,32 @@ void tst_QGraphicsWidget::initialShow() QCOMPARE(widget->repaints, 1); } +void tst_QGraphicsWidget::initialShow2() +{ + class MyGraphicsWidget : public QGraphicsWidget + { public: + MyGraphicsWidget() : repaints(0) {} + int repaints; + void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget*) { ++repaints; } + void polishEvent() { update(); } + }; + + MyGraphicsWidget *widget = new MyGraphicsWidget; + widget->resize(100, 100); + + QGraphicsScene scene(0, 0, 200, 200); + scene.addItem(widget); + + QGraphicsView view(&scene); + view.show(); + // Not using QTest::qWaitForWindowShown(&view); on purpose, because there's + // a bug in qt_x11_wait_for_window_manager that prevents this test + // to pass. Denis is looking into it. + QTest::qWait(300); + + QCOMPARE(widget->repaints, 1); +} + void tst_QGraphicsWidget::QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems() { QGraphicsScene scene; |