diff options
author | Christian Stenger <christian.stenger@digia.com> | 2013-12-12 13:33:04 +0100 |
---|---|---|
committer | Christian Stenger <christian.stenger@digia.com> | 2013-12-12 16:04:49 +0100 |
commit | 969e6364ebe1fcce064482485e5be31e34b6b534 (patch) | |
tree | b40d1b3c5ab46de873448561f83e77466f5db01f /tests | |
parent | 57f09e824aa9d207c70232f0c1421f4b8ad7c049 (diff) |
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>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/system/shared/editor_utils.py | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/tests/system/shared/editor_utils.py b/tests/system/shared/editor_utils.py index ec0b8762d7..d39f336c5c 100644 --- a/tests/system/shared/editor_utils.py +++ b/tests/system/shared/editor_utils.py @@ -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 |