Fix tst_QWindow modal dialog tests for offscreen and minimal platforms

Changed testing of focus of modal dialogs to match behavior on offscreen
and minimal platforms.

Change-Id: Ife3ea41b4b78df2e64c8d8e740332914b1e5a67c
Reviewed-by: Teemu Holappa <teemu.holappa@qt.io>
This commit is contained in:
Sami Nurmenniemi 2017-03-29 14:19:57 +03:00
parent ba21e42463
commit 9b52cfd64c

View File

@ -1852,6 +1852,14 @@ void tst_QWindow::modalDialog()
QGuiApplication::sync();
QGuiApplication::processEvents();
if (!QGuiApplication::platformName().compare(QLatin1String("offscreen"), Qt::CaseInsensitive)
|| !QGuiApplication::platformName().compare(QLatin1String("minimal"), Qt::CaseInsensitive)) {
QWARN("Focus stays in normalWindow on offscreen/minimal platforms");
QTRY_COMPARE(QGuiApplication::focusWindow(), &normalWindow);
return;
}
QTRY_COMPARE(QGuiApplication::focusWindow(), &dialog);
}
@ -1890,6 +1898,14 @@ void tst_QWindow::modalDialogClosingOneOfTwoModal()
QGuiApplication::sync();
QGuiApplication::processEvents();
if (!QGuiApplication::platformName().compare(QLatin1String("offscreen"), Qt::CaseInsensitive)
|| !QGuiApplication::platformName().compare(QLatin1String("minimal"), Qt::CaseInsensitive)) {
QWARN("Focus is lost when closing modal dialog on offscreen/minimal platforms");
QTRY_COMPARE(QGuiApplication::focusWindow(), nullptr);
return;
}
QTRY_COMPARE(QGuiApplication::focusWindow(), &first_dialog);
}