From f05236a40d7ee9299c5855d70e542143a2d342c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 1 Jun 2011 13:02:57 +0200 Subject: Prevent XSetInputFocus BadMatch errors. The BadMatch errors are generated if XSetInputFocus is called before the window has been mapped, so we need to set a flag when we get the map notify event. --- tests/auto/qwidget/tst_qwidget.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/auto/qwidget/tst_qwidget.cpp') diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 7c0042a46c..1d3591d757 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -10226,18 +10226,26 @@ void tst_QWidget::nativeChildFocus() QLineEdit *p2 = new QLineEdit; layout->addWidget(p1); layout->addWidget(p2); +#if 1 p1->setObjectName("p1"); p2->setObjectName("p2"); +#endif w.show(); +#if 1 w.activateWindow(); p1->setFocus(); p1->setAttribute(Qt::WA_NativeWindow); p2->setAttribute(Qt::WA_NativeWindow); QApplication::processEvents(); QTest::qWaitForWindowShown(&w); + QTest::qWait(10); + qDebug() << "checking active window:" << QApplication::activeWindow(); QCOMPARE(QApplication::activeWindow(), &w); QCOMPARE(QApplication::focusWidget(), static_cast(p1)); +#endif + + QTest::qWait(1000); } QTEST_MAIN(tst_QWidget) -- cgit v1.2.3