From 4677cf3d014d9b25c3516dd0e07a1a3fcd8af8e9 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 20 Jul 2012 12:49:12 +0200 Subject: [PATCH] Deprecate the qWaitForWindowShown(QWindow *) method. While the qWaitForWindowShown(QWidget *) is inherited from Qt 4.8, the qWaitForWindowShown(QWindow *) was introduced in Qt 5. As it is identical to qWaitForWindowExposed() and removed already, it can be deprecated in Qt 5. Remove its usages in qtbase. Change-Id: I28788d120ad687a49f02b2b44de6b38a2832fe5c Reviewed-by: Friedemann Kleint Reviewed-by: Stephen Kelly Reviewed-by: Jason McDonald --- src/testlib/qtestsystem.h | 5 +-- .../qguiapplication/tst_qguiapplication.cpp | 16 +++++----- .../kernel/qinputmethod/tst_qinputmethod.cpp | 2 +- .../kernel/qtouchevent/tst_qtouchevent.cpp | 4 +-- tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 20 ++++++------ .../qgraphicsscene/tst_qgraphicsscene.cpp | 9 +++--- .../widgets/kernel/qwidget/tst_qwidget.cpp | 31 +++++++++---------- 7 files changed, 43 insertions(+), 44 deletions(-) diff --git a/src/testlib/qtestsystem.h b/src/testlib/qtestsystem.h index 66849f465d..634452d4af 100644 --- a/src/testlib/qtestsystem.h +++ b/src/testlib/qtestsystem.h @@ -129,12 +129,13 @@ namespace QTest } #endif -#if QT_DEPRECATED_SINCE(6, 0) +#if QT_DEPRECATED_SINCE(5, 0) QT_DEPRECATED inline static bool qWaitForWindowShown(QWindow *window, int timeout = 1000) { return qWaitForWindowExposed(window, timeout); } - +#endif // QT_DEPRECATED_SINCE(5, 0) +#if QT_DEPRECATED_SINCE(6, 0) # ifdef QT_WIDGETS_LIB QT_DEPRECATED inline static bool qWaitForWindowShown(QWidget *widget, int timeout = 1000) { diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp index b9bf79ee65..8eb0234c2c 100644 --- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp +++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp @@ -107,9 +107,9 @@ void tst_QGuiApplication::focusObject() // verify active window focus propagates to qguiapplication - QTest::qWaitForWindowShown(&window1); window1.requestActivateWindow(); - QTRY_COMPARE(app.focusWindow(), &window1); + QVERIFY(QTest::qWaitForWindowActive(&window1)); + QCOMPARE(app.focusWindow(), &window1); window1.setFocusObject(&obj1); QCOMPARE(app.focusObject(), &obj1); @@ -124,7 +124,7 @@ void tst_QGuiApplication::focusObject() window2.setFocusObject(&obj3); QCOMPARE(app.focusObject(), &obj2); // not yet changed window2.show(); - QTest::qWaitForWindowShown(&window2); + QVERIFY(QTest::qWaitForWindowExposed(&window2)); QTRY_COMPARE(app.focusWindow(), &window2); QCOMPARE(app.focusObject(), &obj3); QCOMPARE(spy.count(), 1); @@ -241,8 +241,8 @@ void tst_QGuiApplication::changeFocusWindow() FocusChangeWindow window1, window2; window1.show(); window2.show(); - QTest::qWaitForWindowShown(&window1); - QTest::qWaitForWindowShown(&window2); + QVERIFY(QTest::qWaitForWindowExposed(&window1)); + QVERIFY(QTest::qWaitForWindowExposed(&window2)); window1.requestActivateWindow(); QTRY_COMPARE(app.focusWindow(), &window1); @@ -259,7 +259,7 @@ void tst_QGuiApplication::keyboardModifiers() QWindow *window = new QWindow; window->show(); - QTest::qWaitForWindowShown(window); + QVERIFY(QTest::qWaitForWindowExposed(window)); QCOMPARE(QGuiApplication::keyboardModifiers(), Qt::NoModifier); // mouse events @@ -378,8 +378,8 @@ void tst_QGuiApplication::modalWindow() // show the 2 windows, nothing is blocked window1->show(); window2->show(); - QTest::qWaitForWindowShown(window1); - QTest::qWaitForWindowShown(window2); + QVERIFY(QTest::qWaitForWindowExposed(window1)); + QVERIFY(QTest::qWaitForWindowExposed(window2)); QCOMPARE(app.modalWindow(), static_cast(0)); QCOMPARE(window1->blocked, 0); QCOMPARE(window2->blocked, 0); diff --git a/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp b/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp index 5bbd4958da..1b468847b2 100644 --- a/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp +++ b/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp @@ -313,7 +313,7 @@ void tst_qinputmethod::inputMethodAccepted() DummyWindow window; window.show(); - QTest::qWaitForWindowShown(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); window.requestActivateWindow(); QTRY_COMPARE(qApp->focusWindow(), &window); window.setFocusObject(&disabledItem); diff --git a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp index 3adf2868be..ee5cb8efeb 100644 --- a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp +++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp @@ -1503,7 +1503,7 @@ void tst_QTouchEvent::testQGuiAppDelivery() QWindow *w = new QWindow; w->setGeometry(100, 100, 100, 100); w->show(); - QTest::qWaitForWindowShown(w); + QVERIFY(QTest::qWaitForWindowExposed(w)); WindowTouchEventFilter filter; w->installEventFilter(&filter); @@ -1563,7 +1563,7 @@ void tst_QTouchEvent::testMultiDevice() QWindow *w = new QWindow; w->setGeometry(100, 100, 100, 100); w->show(); - QTest::qWaitForWindowShown(w); + QVERIFY(QTest::qWaitForWindowExposed(w)); WindowTouchEventFilter filter; w->installEventFilter(&filter); diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 73f70fbe3c..f2393f905e 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -420,7 +420,7 @@ void tst_QWindow::testInputEvents() InputTestWindow window; window.setGeometry(80, 80, 40, 40); window.show(); - QTest::qWaitForWindowShown(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); QWindowSystemInterface::handleKeyEvent(&window, QEvent::KeyPress, Qt::Key_A, Qt::NoModifier); QWindowSystemInterface::handleKeyEvent(&window, QEvent::KeyRelease, Qt::Key_A, Qt::NoModifier); @@ -478,7 +478,7 @@ void tst_QWindow::touchToMouseTranslation() window.ignoreTouch = true; window.setGeometry(80, 80, 40, 40); window.show(); - QTest::qWaitForWindowShown(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); QList points; QWindowSystemInterface::TouchPoint tp1, tp2; @@ -554,7 +554,7 @@ void tst_QWindow::mouseToTouchTranslation() window.ignoreMouse = true; window.setGeometry(80, 80, 40, 40); window.show(); - QTest::qWaitForWindowShown(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); QWindowSystemInterface::handleMouseEvent(&window, QPoint(10, 10), window.mapToGlobal(QPoint(10, 10)), Qt::LeftButton); QWindowSystemInterface::handleMouseEvent(&window, QPoint(10, 10), window.mapToGlobal(QPoint(10, 10)), Qt::NoButton); @@ -603,7 +603,7 @@ void tst_QWindow::mouseToTouchLoop() window.ignoreTouch = true; window.setGeometry(80, 80, 40, 40); window.show(); - QTest::qWaitForWindowShown(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); QWindowSystemInterface::handleMouseEvent(&window, QPoint(10, 10), window.mapToGlobal(QPoint(10, 10)), Qt::LeftButton); QWindowSystemInterface::handleMouseEvent(&window, QPoint(10, 10), window.mapToGlobal(QPoint(10, 10)), Qt::NoButton); @@ -618,7 +618,7 @@ void tst_QWindow::touchCancel() InputTestWindow window; window.setGeometry(80, 80, 40, 40); window.show(); - QTest::qWaitForWindowShown(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); QList points; QWindowSystemInterface::TouchPoint tp1; @@ -678,7 +678,7 @@ void tst_QWindow::touchCancelWithTouchToMouse() window.ignoreTouch = true; window.setGeometry(80, 80, 40, 40); window.show(); - QTest::qWaitForWindowShown(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); QList points; QWindowSystemInterface::TouchPoint tp1; @@ -757,9 +757,9 @@ void tst_QWindow::activateAndClose() for (int i = 0; i < 10; ++i) { QWindow window; window.show(); - QTest::qWaitForWindowShown(&window); window.requestActivateWindow(); - QTRY_COMPARE(qGuiApp->focusWindow(), &window); + QVERIFY(QTest::qWaitForWindowActive(&window)); + QCOMPARE(qGuiApp->focusWindow(), &window); } } @@ -770,7 +770,7 @@ void tst_QWindow::mouseEventSequence() InputTestWindow window; window.setGeometry(80, 80, 40, 40); window.show(); - QTest::qWaitForWindowShown(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); ulong timestamp = 0; QPointF local(12, 34); @@ -892,7 +892,7 @@ void tst_QWindow::inputReentrancy() window.setGeometry(80, 80, 40, 40); window.show(); - QTest::qWaitForWindowShown(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); // Queue three events. QPointF local(12, 34); diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index 1c5702d15f..7299e2ad8b 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -1078,7 +1078,7 @@ void tst_QGraphicsScene::addItem() CustomView view; view.setScene(&scene); view.show(); - QTest::qWaitForWindowShown(view.windowHandle()); + QVERIFY(QTest::qWaitForWindowExposed(&view)); qApp->processEvents(); view.repaints = 0; @@ -1606,10 +1606,9 @@ void tst_QGraphicsScene::hoverEvents_siblings() view.rotate(10); view.scale(1.7, 1.7); view.show(); - QTest::qWaitForWindowShown(view.windowHandle()); qApp->setActiveWindow(&view); view.activateWindow(); - QTest::qWait(70); + QVERIFY(QTest::qWaitForWindowActive(&view)); QCursor::setPos(view.mapToGlobal(QPoint(-5, -5))); @@ -2737,8 +2736,8 @@ void tst_QGraphicsScene::contextMenuEvent() QGraphicsView view(&scene); view.show(); - QTest::qWaitForWindowShown(view.windowHandle()); view.activateWindow(); + QVERIFY(QTest::qWaitForWindowActive(&view)); view.centerOn(item); { @@ -2771,7 +2770,7 @@ void tst_QGraphicsScene::contextMenuEvent_ItemIgnoresTransformations() QGraphicsView view(&scene, &topLevel); view.resize(200, 200); topLevel.show(); - QTest::qWaitForWindowShown(topLevel.windowHandle()); + QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); { QPoint pos(50, 50); diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index c9d8b3162e..1b4cacf91c 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -1645,8 +1645,7 @@ void tst_QWidget::setTabOrder() container.show(); container.activateWindow(); qApp->setActiveWindow(&container); - QTest::qWaitForWindowShown(container.windowHandle()); - QTest::qWait(100); + QVERIFY(QTest::qWaitForWindowActive(&container)); QTRY_VERIFY(lastEdit->hasFocus()); container.tab(); @@ -3085,7 +3084,7 @@ void tst_QWidget::restoreVersion1Geometry() widgetToSave.move(expectedPosition); widgetToSave.resize(expectedSize); widgetToSave.show(); - QTest::qWaitForWindowShown(widget.windowHandle()); + QVERIFY(QTest::qWaitForWindowExposed(&widget)); QTest::qWait(500); // stabilize widgetToSave.setWindowState(Qt::WindowStates(expectedWindowState)); QTest::qWait(500); // stabilize @@ -4768,7 +4767,7 @@ void tst_QWidget::popupEnterLeave() parent.show(); - QTest::qWaitForWindowShown(parent.windowHandle()); + QVERIFY(QTest::qWaitForWindowExposed(&parent)); QWindowSystemInterface::handleMouseEvent(parent.windowHandle(), QPointF(5, 5), QPointF(), Qt::LeftButton, Qt::NoModifier); QTest::qWait(100); @@ -4788,7 +4787,7 @@ void tst_QWidget::popupEnterLeave() popup.show(); - QTest::qWaitForWindowShown(popup.windowHandle()); + QVERIFY(QTest::qWaitForWindowExposed(&popup)); QTest::qWait(100); @@ -5491,7 +5490,7 @@ void tst_QWidget::minAndMaxSizeWithX11BypassWindowManagerHint() QCOMPARE(widget.size(), newMaximumSize); widget.show(); - QTest::qWaitForWindowShown(widget.windowHandle()); + QVERIFY(QTest::qWaitForWindowExposed(&widget)); QCOMPARE(widget.size(), newMaximumSize); } @@ -5503,7 +5502,7 @@ void tst_QWidget::minAndMaxSizeWithX11BypassWindowManagerHint() QCOMPARE(widget.size(), newMinimumSize); widget.show(); - QTest::qWaitForWindowShown(widget.windowHandle()); + QVERIFY(QTest::qWaitForWindowExposed(&widget)); QCOMPARE(widget.size(), newMinimumSize); } } @@ -6909,7 +6908,7 @@ void tst_QWidget::moveWindowInShowEvent() // show it widget.show(); - QTest::qWaitForWindowShown(widget.windowHandle()); + QVERIFY(QTest::qWaitForWindowShown(&widget)); QTest::qWait(100); // it should have moved QCOMPARE(widget.pos(), position); @@ -7052,7 +7051,7 @@ void tst_QWidget::alienWidgets() QWidget greatGrandChild(&grandChild); parent.show(); - QTest::qWaitForWindowShown(parent.windowHandle()); + QVERIFY(QTest::qWaitForWindowExposed(&parent)); // Verify that the WA_WState_Created attribute is set // and the top-level is the only native window. @@ -7501,7 +7500,7 @@ void tst_QWidget::sendUpdateRequestImmediately() UpdateWidget updateWidget; updateWidget.show(); - QTest::qWaitForWindowShown(updateWidget.windowHandle()); + QVERIFY(QTest::qWaitForWindowExposed(&updateWidget)); qApp->processEvents(); updateWidget.reset(); @@ -7586,7 +7585,7 @@ void tst_QWidget::opaqueChildren() greatGrandChild.setAutoFillBackground(true); // Opaque child widget. widget.show(); - QTest::qWaitForWindowShown(widget.windowHandle()); + QVERIFY(QTest::qWaitForWindowExposed(&widget)); QTest::qWait(100); // Child, grandChild and greatGrandChild are outside the ancestor clip. @@ -7740,7 +7739,7 @@ void tst_QWidget::immediateRepaintAfterInvalidateBuffer() QWidget *widget = new UpdateWidget; widget->show(); - QTest::qWaitForWindowShown(widget->windowHandle()); + QVERIFY(QTest::qWaitForWindowExposed(widget)); QTest::qWait(200); static_cast(widget)->numPaintEvents = 0; @@ -8097,7 +8096,7 @@ void tst_QWidget::translucentWidget() const QPoint labelPos = qApp->desktop()->availableGeometry().topLeft(); label.move(labelPos); label.show(); - QTest::qWaitForWindowShown(label.windowHandle()); + QVERIFY(QTest::qWaitForWindowExposed(&label)); QTest::qWait(200); QPixmap widgetSnapshot; @@ -8484,7 +8483,7 @@ void tst_QWidget::syntheticEnterLeave() window.show(); window.raise(); - QTest::qWaitForWindowShown(window.windowHandle()); + QVERIFY(QTest::qWaitForWindowExposed(&window)); QTest::qWait(300); #define RESET_EVENT_COUNTS \ @@ -8587,7 +8586,7 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave() SELChild child(&parent); child.resize(200, 200); parent.show(); - QTest::qWaitForWindowShown(parent.windowHandle()); + QVERIFY(QTest::qWaitForWindowExposed(&parent)); QTest::qWait(150); QCursor::setPos(child.mapToGlobal(QPoint(100, 100))); @@ -8689,7 +8688,7 @@ void tst_QWidget::updateOnDestroyedSignal() child->setPalette(Qt::red); widget.show(); - QTest::qWaitForWindowShown(widget.windowHandle()); + QVERIFY(QTest::qWaitForWindowExposed(&widget)); QTest::qWait(200); // Please do not crash.