tst_QWindow: Set explicit window position to please qWaitForWindowActive

qWaitForWindowActive waits until the timeout for the window to receive
a non-0x0 position, even when it's active, just in case the WM sets
the position as a response to focus-in.

Change-Id: I748cce2747f406a8cdff556465175f02675fcd13
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
bb10
Tor Arne Vestbø 2013-11-15 19:25:54 +01:00 committed by The Qt Project
parent 98f0b46689
commit 69a8c59b3f
1 changed files with 4 additions and 1 deletions

View File

@ -843,7 +843,10 @@ void tst_QWindow::activateAndClose()
{
for (int i = 0; i < 10; ++i) {
QWindow window;
window.show();
// qWaitForWindowActive will block for the duration of
// of the timeout if the window is at 0,0
window.setGeometry(QGuiApplication::primaryScreen()->availableGeometry().adjusted(1, 1, -1, -1));
window.showNormal();
window.requestActivate();
QVERIFY(QTest::qWaitForWindowActive(&window));
QCOMPARE(qGuiApp->focusWindow(), &window);