diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2012-07-24 14:29:01 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-25 17:32:21 +0200 |
commit | aaaf60aeab64c4e9189dae6925a89e0b367e3dcf (patch) | |
tree | 6c2f3d4217245c7a61244a62f599206bd59c0a67 /tests/auto/other | |
parent | ff453fa757c154e9234541c5cda47014a0803538 (diff) |
Remove usage of deprecated qWaitForWindowShown(QWidget *) method.
Remove usages from autotests with the exception of
widgets/kernel, widgets/widgets and widgets/graphicsview.
Change-Id: I917b2857ed0cd07a6b3dbcd69244f558086c6586
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'tests/auto/other')
4 files changed, 33 insertions, 39 deletions
diff --git a/tests/auto/other/baselineexample/tst_baselineexample.cpp b/tests/auto/other/baselineexample/tst_baselineexample.cpp index 78e531a9f7..ca803c4189 100644 --- a/tests/auto/other/baselineexample/tst_baselineexample.cpp +++ b/tests/auto/other/baselineexample/tst_baselineexample.cpp @@ -70,7 +70,7 @@ void tst_BaselineExample::testBasicUsage() QPushButton b("Press me!"); b.resize(100, 50); b.show(); - QTest::qWaitForWindowShown(&b); + QVERIFY(QTest::qWaitForWindowExposed(&b)); QImage img1 = b.grab().toImage(); QVERIFY(!img1.isNull()); @@ -84,7 +84,7 @@ void tst_BaselineExample::testMultipleImages() QPushButton b("Press me!"); b.resize(100, 50); b.show(); - QTest::qWaitForWindowShown(&b); + QVERIFY(QTest::qWaitForWindowExposed(&b)); QBASELINE_CHECK(b.grab().toImage(), "text1"); b.setText("Kick me!"); @@ -110,7 +110,7 @@ void tst_BaselineExample::testDataDriven() QPushButton b(label); b.resize(100, 50); b.show(); - QTest::qWaitForWindowShown(&b); + QVERIFY(QTest::qWaitForWindowExposed(&b)); QBASELINE_TEST(b.grab().toImage()); } @@ -136,7 +136,7 @@ void tst_BaselineExample::testDataDrivenChecksum() QPushButton b(label); b.resize(100, 50); b.show(); - QTest::qWaitForWindowShown(&b); + QVERIFY(QTest::qWaitForWindowExposed(&b)); QBASELINE_TEST(b.grab().toImage()); } diff --git a/tests/auto/other/gestures/tst_gestures.cpp b/tests/auto/other/gestures/tst_gestures.cpp index 917337a7d9..db10877b8a 100644 --- a/tests/auto/other/gestures/tst_gestures.cpp +++ b/tests/auto/other/gestures/tst_gestures.cpp @@ -394,7 +394,7 @@ void tst_Gestures::customGesture() GestureWidget widget; widget.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); widget.show(); - QTest::qWaitForWindowShown(&widget); + QVERIFY(QTest::qWaitForWindowExposed(&widget)); CustomEvent event; event.hotSpot = widget.mapToGlobal(QPoint(5,5)); @@ -863,7 +863,7 @@ void tst_Gestures::graphicsItemGesture() item->setPos(100, 100); view.show(); - QTest::qWaitForWindowShown(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); view.ensureVisible(scene.sceneRect()); item->grabGesture(CustomGesture::GestureType); @@ -925,7 +925,7 @@ void tst_Gestures::graphicsView() item->setPos(100, 100); view.show(); - QTest::qWaitForWindowShown(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); view.ensureVisible(scene.sceneRect()); item->grabGesture(CustomGesture::GestureType); @@ -1001,7 +1001,7 @@ void tst_Gestures::graphicsItemTreeGesture() item1_child2->setParentItem(item1); view.show(); - QTest::qWaitForWindowShown(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); view.ensureVisible(scene.sceneRect()); item1->grabGesture(CustomGesture::GestureType); @@ -1058,7 +1058,7 @@ void tst_Gestures::explicitGraphicsObjectTarget() item2_child1->setPos(10, 10); view.show(); - QTest::qWaitForWindowShown(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); view.ensureVisible(scene.sceneRect()); item1->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); @@ -1117,7 +1117,7 @@ void tst_Gestures::gestureOverChildGraphicsItem() item2_child1->setPos(0, 0); view.show(); - QTest::qWaitForWindowShown(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); view.ensureVisible(scene.sceneRect()); item1->grabGesture(CustomGesture::GestureType); @@ -1415,7 +1415,7 @@ void tst_Gestures::testMapToScene() item0->setPos(14, 16); view.show(); // need to show to give it a global coordinate - QTest::qWaitForWindowShown(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); view.ensureVisible(scene.sceneRect()); QPoint origin = view.mapToGlobal(QPoint()); @@ -1541,7 +1541,7 @@ void tst_Gestures::autoCancelGestures() parent.grabGesture(CustomGesture::GestureType); child->grabGesture(secondGesture); parent.show(); - QTest::qWaitForWindowShown(&parent); + QVERIFY(QTest::qWaitForWindowExposed(&parent)); /* An event is send to both the child and the parent, when the child gets it a gesture is triggered @@ -1600,7 +1600,7 @@ void tst_Gestures::autoCancelGestures2() child->grabGesture(secondGesture); view.show(); - QTest::qWaitForWindowShown(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); view.ensureVisible(scene.sceneRect()); CustomEvent event; @@ -1646,7 +1646,7 @@ void tst_Gestures::graphicsViewParentPropagation() item1_c1_c1->setPos(0, 0); view.show(); - QTest::qWaitForWindowShown(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); view.ensureVisible(scene.sceneRect()); item0->grabGesture(CustomGesture::GestureType, Qt::ReceivePartialGestures | Qt::IgnoredGesturesPropagateToParent); @@ -1716,7 +1716,7 @@ void tst_Gestures::panelPropagation() item1_child1_child1->setZValue(10); view.show(); - QTest::qWaitForWindowShown(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); view.ensureVisible(scene.sceneRect()); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; @@ -1827,7 +1827,7 @@ void tst_Gestures::panelStacksBehindParent() panel->setZValue(5); view.show(); - QTest::qWaitForWindowShown(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); view.ensureVisible(scene.sceneRect()); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; @@ -1911,7 +1911,7 @@ void tst_Gestures::deleteGestureTargetItem() items.insert(item2->objectName(), item2); view.show(); - QTest::qWaitForWindowShown(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); view.ensureVisible(scene.sceneRect()); if (propagateUpdateGesture) @@ -1956,7 +1956,7 @@ void tst_Gestures::viewportCoordinates() scene.addItem(item1); view.show(); - QTest::qWaitForWindowShown(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); view.ensureVisible(scene.sceneRect()); CustomEvent event; @@ -1993,7 +1993,7 @@ void tst_Gestures::partialGesturePropagation() scene.addItem(item4); view.show(); - QTest::qWaitForWindowShown(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); view.ensureVisible(scene.sceneRect()); item1->ignoredUpdatedGestures << CustomGesture::GestureType; @@ -2081,7 +2081,7 @@ void tst_Gestures::testQGestureRecognizerCleanup() //QGestureRecognizer::registerRecognizer(new PanRecognizer(PanRecognizer::Custom)); w->show(); - QTest::qWaitForWindowShown(w); + QVERIFY(QTest::qWaitForWindowExposed(w)); delete w; } @@ -2202,7 +2202,7 @@ void tst_Gestures::testReuseCanceledGestures() gv->viewport()->grabGesture(tapGestureTypeId); mw.show(); - QTest::qWaitForWindowShown(&mw); + QVERIFY(QTest::qWaitForWindowExposed(&mw)); QPoint targetPos(gv->mapFromScene(target->mapToScene(target->rect().center()))); targetPos = gv->viewport()->mapFromParent(targetPos); @@ -2268,7 +2268,7 @@ void tst_Gestures::conflictingGesturesInGraphicsView() scene.addItem(item2); view.show(); - QTest::qWaitForWindowShown(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); view.ensureVisible(scene.sceneRect()); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; @@ -2333,7 +2333,7 @@ void tst_Gestures::bug_13501_gesture_not_accepted() NoConsumeWidgetBug13501 w; w.grabGesture(Qt::TapGesture); w.show(); - QTest::qWaitForWindowShown(&w); + QVERIFY(QTest::qWaitForWindowExposed(&w)); //QTest::mousePress(&ignoreEvent, Qt::LeftButton); QTouchDevice *device = new QTouchDevice; device->setType(QTouchDevice::TouchScreen); diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index f06fa92ff1..90dc4053e7 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -756,7 +756,7 @@ void tst_QAccessibility::actionTest() { QPushButton *button = new QPushButton; button->show(); - QTest::qWaitForWindowShown(button); + QVERIFY(QTest::qWaitForWindowExposed(button)); button->clearFocus(); QCOMPARE(button->hasFocus(), false); QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(button); @@ -2959,7 +2959,7 @@ void tst_QAccessibility::bridgeTest() lay->addWidget(te); window->show(); - QTest::qWaitForWindowShown(window); + QVERIFY(QTest::qWaitForWindowExposed(window)); /************************************************** diff --git a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp index 05a609c8a6..3a95ddb580 100644 --- a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp +++ b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp @@ -135,6 +135,7 @@ void tst_QFocusEvent::initTestCase() //qApp->setMainWidget( testFocusWidget ); Qt4 testFocusWidget->resize( 200,100 ); testFocusWidget->show(); + QVERIFY(QTest::qWaitForWindowExposed(testFocusWidget)); // Applications don't get focus when launched from the command line on Mac. #ifdef Q_OS_MAC testFocusWidget->raise(); @@ -159,19 +160,10 @@ void tst_QFocusEvent::initWidget() { // On X11 we have to ensure the event was processed before doing any checking, on Windows // this is processed straight away. - QApplication::setActiveWindow(childFocusWidgetOne); - - for (int i = 0; i < 1000; ++i) { - if (childFocusWidgetOne->isActiveWindow() && childFocusWidgetOne->hasFocus()) - break; - childFocusWidgetOne->activateWindow(); - childFocusWidgetOne->setFocus(); - qApp->processEvents(); - QTest::qWait(100); - } - - // The first lineedit should have focus - QVERIFY( childFocusWidgetOne->hasFocus() ); + QApplication::setActiveWindow(testFocusWidget); + childFocusWidgetOne->setFocus(); // The first lineedit should have focus + QVERIFY(QTest::qWaitForWindowActive(testFocusWidget)); + QTRY_VERIFY(childFocusWidgetOne->hasFocus()); childFocusWidgetOne->focusInEventRecieved = false; childFocusWidgetOne->focusInEventGotFocus = false; @@ -362,7 +354,7 @@ void tst_QFocusEvent::checkReason_ActiveWindow() d->show(); d->activateWindow(); // ### CDE QApplication::setActiveWindow(d); - QTest::qWaitForWindowShown(d); + QVERIFY(QTest::qWaitForWindowActive(d)); QTRY_VERIFY(childFocusWidgetOne->focusOutEventRecieved); QVERIFY(childFocusWidgetOne->focusOutEventLostFocus); @@ -381,6 +373,8 @@ void tst_QFocusEvent::checkReason_ActiveWindow() #ifdef Q_OS_MAC QEXPECT_FAIL("", "QTBUG-22815", Abort); #endif + if (QGuiApplication::platformName() == QStringLiteral("xcb")) + QSKIP("QTBUG-22815 - This test is unstable on this platform"); QTRY_VERIFY(childFocusWidgetOne->focusInEventRecieved); QVERIFY(childFocusWidgetOne->focusInEventGotFocus); |