From 07ba87349d139a2d1b4dec9e3138c165dcbc747c Mon Sep 17 00:00:00 2001
From: Christian Stenger <christian.stenger@qt.io>
Date: Fri, 13 May 2016 10:06:30 +0200
Subject: [PATCH] Squish: Fix accessing Options on OSX

Accessing the application menu inside the menubar of OSX
does not work properly since using Qt5.
For some time using default keysequences worked fine, but
for the Preferences (Options menu) this stopped working,
so make the used hack even more crude.

Change-Id: I48ed37dc69b8c64f649f0130d48d4deb02afb87e
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
---
 tests/system/shared/utils.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py
index 97f1d7c5d42..d75d683dfb8 100644
--- a/tests/system/shared/utils.py
+++ b/tests/system/shared/utils.py
@@ -176,10 +176,17 @@ def invokeMenuItem(menu, item, *subItems):
             waitForObject(":Qt Creator.QtCreator.MenuBar_QMenuBar", 2000)
         except:
             nativeMouseClick(waitForObject(":Qt Creator_Core::Internal::MainWindow", 1000), 20, 20, 0, Qt.LeftButton)
-    # HACK to avoid squish crash using Qt5.2 on Squish 5.0.1 - remove asap
+    # HACK as Squish fails to provide a proper way to access the system menu
     if platform.system() == "Darwin":
         if menu == "Tools" and item == "Options...":
-            nativeType("<Command+,>")
+            #nativeType("<Command+,>")
+            # the following is a pure HACK because using the default key sequence seems to be broken
+            # when running from inside Squish
+            menuBar = waitForObject(":Qt Creator.QtCreator.MenuBar_QMenuBar", 500)
+            nativeMouseClick(menuBar, 75, 5, 0, Qt.LeftButton)
+            for _ in range(3):
+                nativeType("<Down>")
+            nativeType("<Return>")
             return
         if menu == "File" and item == "Exit":
             nativeType("<Command+q>")
-- 
GitLab