From c7e7a785c6e3bec422fe5b62361e5417240c0ada Mon Sep 17 00:00:00 2001 From: Sami Nurmenniemi Date: Thu, 6 Apr 2017 10:09:11 +0300 Subject: tst_QFocusEvent: Fix checkReason_ActivateWindow for offscreen and minimal platforms Widgets in platforms offscreen and minimal don't get focus back automatically after hiding focused window. Extra activateWindow is needed. Task-number: QTBUG-59966 Change-Id: Iaf3d4e60483c4b2600472af199f7a7cd51b3fa6e Reviewed-by: Friedemann Kleint --- tests/auto/other/qfocusevent/tst_qfocusevent.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/auto/other/qfocusevent') diff --git a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp index 5137ba0c57..5bf39b3953 100644 --- a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp +++ b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp @@ -340,6 +340,14 @@ void tst_QFocusEvent::checkReason_ActiveWindow() #if defined(Q_OS_IRIX) QEXPECT_FAIL("", "IRIX requires explicit activateWindow(), so this test does not make any sense.", Abort); #endif + + if (!QGuiApplication::platformName().compare(QLatin1String("offscreen"), Qt::CaseInsensitive) + || !QGuiApplication::platformName().compare(QLatin1String("minimal"), Qt::CaseInsensitive)) { + // Activate window of testFocusWidget, focus in that window goes to childFocusWidgetOne + QWARN("Platforms offscreen and minimal require explicit activateWindow()"); + testFocusWidget->activateWindow(); + } + QTRY_VERIFY(childFocusWidgetOne->focusInEventRecieved); QVERIFY(childFocusWidgetOne->focusInEventGotFocus); -- cgit v1.2.3