diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-02-09 13:09:34 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-02-09 13:09:34 (GMT) |
commit | ec0f388dfb14712a144d534296b33df7e6a2df7f (patch) | |
tree | ab4d6b9da547a6439ae6f434a69ee3f202d328d7 /tests/auto/qgraphicswidget | |
parent | 6165ab0203fa80d31f3488ead7e7f7c088c8668c (diff) | |
parent | 3b1a0c4877faa9d1d50372f2128c06530ae4b2d4 (diff) | |
download | Qt-ec0f388dfb14712a144d534296b33df7e6a2df7f.zip Qt-ec0f388dfb14712a144d534296b33df7e6a2df7f.tar.gz Qt-ec0f388dfb14712a144d534296b33df7e6a2df7f.tar.bz2 |
Merge remote branch 'qt/4.6' into qt-master-from-4.6
Conflicts:
src/gui/kernel/qcocoapanel_mac.mm
src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
Diffstat (limited to 'tests/auto/qgraphicswidget')
-rw-r--r-- | tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index 79ce68e..6941d23 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -165,6 +165,7 @@ private slots: void polishEvent2(); void autoFillBackground(); void initialShow(); + void initialShow2(); // Task fixes void task236127_bspTreeIndexFails(); @@ -2908,6 +2909,48 @@ 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(); } + }; + + // 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); + dummyView->setWindowFlags(Qt::X11BypassWindowManagerHint); + EventSpy paintSpy(dummyView->viewport(), QEvent::Paint); + dummyView->show(); + QTest::qWaitForWindowShown(dummyView); + const int expectedRepaintCount = paintSpy.count(); + delete dummyView; + dummyView = 0; + QTest::qWait(200); + + MyGraphicsWidget *widget = new MyGraphicsWidget; + widget->resize(100, 100); + + QGraphicsScene scene(0, 0, 200, 200); + scene.addItem(widget); + + QGraphicsView view(&scene); + view.setWindowFlags(Qt::X11BypassWindowManagerHint); + view.show(); + QTest::qWaitForWindowShown(&view); + + QCOMPARE(widget->repaints, expectedRepaintCount); +} + void tst_QGraphicsWidget::QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems() { QGraphicsScene scene; |