diff options
Diffstat (limited to 'tests/auto/qgraphicswidget')
-rw-r--r-- | tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index 526486e..a7195c4 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -2892,6 +2892,26 @@ void tst_QGraphicsWidget::initialShow2() void polishEvent() { update(); } }; + // Don't let paint events triggered by the windowing system + // influence our test case. We're only interested in knowing + // whether a QGraphicsWidget generates an additional repaint + // on the inital show. Hence create a dummy scenario to find out + // how many repaints we should expect. + QGraphicsScene dummyScene(0, 0, 200, 200); + dummyScene.addItem(new QGraphicsRectItem(0, 0, 100, 100)); + + QGraphicsView *dummyView = new QGraphicsView(&dummyScene); + EventSpy paintSpy(dummyView->viewport(), QEvent::Paint); + dummyView->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); + const int expectedRepaintCount = paintSpy.count(); + delete dummyView; + dummyView = 0; + QTest::qWait(200); + MyGraphicsWidget *widget = new MyGraphicsWidget; widget->resize(100, 100); @@ -2905,7 +2925,7 @@ void tst_QGraphicsWidget::initialShow2() // to pass. Denis is looking into it. QTest::qWait(300); - QCOMPARE(widget->repaints, 1); + QCOMPARE(widget->repaints, expectedRepaintCount); } void tst_QGraphicsWidget::QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems() |