From 9b52cfd64c089901b2e3fa0a19d6f342adad6025 Mon Sep 17 00:00:00 2001 From: Sami Nurmenniemi Date: Wed, 29 Mar 2017 14:19:57 +0300 Subject: 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 --- tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 36ec28de8d..0196c7d72c 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -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); } -- cgit v1.2.3