Commit 969e6364 authored by Christian Stenger's avatar Christian Stenger
Browse files

Squish: Avoid crash on Mac when invoking context menus



Again this is a hack to avoid AUT crashes when using Squish 5.0.1
with Qt Creator based on Qt5.2.

Change-Id: I34e35f3892cf3c1cffdc4985234562c1c6f0848b
Reviewed-by: default avatarRobert Loehning <robert.loehning@digia.com>
parent 57f09e82
......@@ -75,6 +75,13 @@ def placeCursorToLine(editor, line, isRegex=False):
def menuVisibleAtEditor(editor, menuInList):
menuInList[0] = None
try:
# Hack for Squish 5.0.1 handling menus of Qt5.2 on Mac (avoids crash) - remove asap
if platform.system() == 'Darwin':
for obj in object.topLevelObjects():
if className(obj) == "QMenu" and obj.visible and widgetContainsPoint(editor, obj.mapToGlobal(QPoint(0, 0))):
menuInList[0] = obj
return True
return False
menu = waitForObject("{type='QMenu' unnamed='1' visible='1'}", 500)
if platform.system() == 'Darwin':
menu.activateWindow()
......@@ -316,10 +323,20 @@ def validateSearchResult(expectedCount):
# this function invokes context menu and command from it
def invokeContextMenuItem(editorArea, command1, command2 = None):
ctxtMenu = openContextMenuOnTextCursorPosition(editorArea)
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), command1, 2000))
if platform.system() == 'Darwin':
activateItem(ctxtMenu, command1)
else:
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), command1, 2000))
if command2:
activateItem(waitForObjectItem("{title='%s' type='QMenu' visible='1' window=%s}"
% (command1, objectMap.realName(ctxtMenu)), command2, 2000))
# Hack for Squish 5.0.1 handling menus of Qt5.2 on Mac (avoids crash) - remove asap
if platform.system() == 'Darwin':
for obj in object.topLevelObjects():
if className(obj) == 'QMenu' and obj.visible and not obj == ctxtMenu:
activateItem(obj, command2)
break
else:
activateItem(waitForObjectItem("{title='%s' type='QMenu' visible='1' window=%s}"
% (command1, objectMap.realName(ctxtMenu)), command2, 2000))
# this function invokes the "Find Usages" item from context menu
# param editor an editor object
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment