summaryrefslogtreecommitdiffstats
path: root/tests/auto/other/qfocusevent/tst_qfocusevent.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2012-07-24 14:29:01 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-25 17:32:21 +0200
commitaaaf60aeab64c4e9189dae6925a89e0b367e3dcf (patch)
tree6c2f3d4217245c7a61244a62f599206bd59c0a67 /tests/auto/other/qfocusevent/tst_qfocusevent.cpp
parentff453fa757c154e9234541c5cda47014a0803538 (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/qfocusevent/tst_qfocusevent.cpp')
-rw-r--r--tests/auto/other/qfocusevent/tst_qfocusevent.cpp22
1 files changed, 8 insertions, 14 deletions
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);