summaryrefslogtreecommitdiffstats
path: root/tests/auto/qwidget/tst_qwidget.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-06-01 13:02:57 +0200
committerSamuel Rødal <samuel.rodal@nokia.com>2011-06-01 13:37:44 +0200
commitf05236a40d7ee9299c5855d70e542143a2d342c8 (patch)
treec782143206780620f9e5ff3036273b494a18fab3 /tests/auto/qwidget/tst_qwidget.cpp
parentead7c1c33c12a078638202b98be7081a4d008780 (diff)
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.
Diffstat (limited to 'tests/auto/qwidget/tst_qwidget.cpp')
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp8
1 files changed, 8 insertions, 0 deletions
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<QWidget*>(p1));
+#endif
+
+ QTest::qWait(1000);
}
QTEST_MAIN(tst_QWidget)