forked from qt-creator/qt-creator
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: Robert Loehning <robert.loehning@digia.com>
This commit is contained in:
@@ -75,6 +75,13 @@ def placeCursorToLine(editor, line, isRegex=False):
|
|||||||
def menuVisibleAtEditor(editor, menuInList):
|
def menuVisibleAtEditor(editor, menuInList):
|
||||||
menuInList[0] = None
|
menuInList[0] = None
|
||||||
try:
|
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)
|
menu = waitForObject("{type='QMenu' unnamed='1' visible='1'}", 500)
|
||||||
if platform.system() == 'Darwin':
|
if platform.system() == 'Darwin':
|
||||||
menu.activateWindow()
|
menu.activateWindow()
|
||||||
@@ -316,10 +323,20 @@ def validateSearchResult(expectedCount):
|
|||||||
# this function invokes context menu and command from it
|
# this function invokes context menu and command from it
|
||||||
def invokeContextMenuItem(editorArea, command1, command2 = None):
|
def invokeContextMenuItem(editorArea, command1, command2 = None):
|
||||||
ctxtMenu = openContextMenuOnTextCursorPosition(editorArea)
|
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:
|
if command2:
|
||||||
activateItem(waitForObjectItem("{title='%s' type='QMenu' visible='1' window=%s}"
|
# Hack for Squish 5.0.1 handling menus of Qt5.2 on Mac (avoids crash) - remove asap
|
||||||
% (command1, objectMap.realName(ctxtMenu)), command2, 2000))
|
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
|
# this function invokes the "Find Usages" item from context menu
|
||||||
# param editor an editor object
|
# param editor an editor object
|
||||||
|
Reference in New Issue
Block a user