From aaaf60aeab64c4e9189dae6925a89e0b367e3dcf Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 24 Jul 2012 14:29:01 +0200 Subject: 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 --- tests/auto/other/qfocusevent/tst_qfocusevent.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'tests/auto/other/qfocusevent/tst_qfocusevent.cpp') 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); -- cgit v1.2.3