summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2010-02-04 13:51:59 (GMT)
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2010-02-04 13:51:59 (GMT)
commit63d50974f104f3626fee13c24251b91a6b3d046b (patch)
treea28398fb932bdbc6f9ac62c00e54163fb370dcb0
parentbc1638138b71adf056f5972b7b1239f4eeffcfec (diff)
downloadQt-63d50974f104f3626fee13c24251b91a6b3d046b.zip
Qt-63d50974f104f3626fee13c24251b91a6b3d046b.tar.gz
Qt-63d50974f104f3626fee13c24251b91a6b3d046b.tar.bz2
Stabilize tst_QGraphicsWidget::initialShow2 (new test)
-rw-r--r--tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp22
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()