summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@digia.com>2014-01-28 14:21:32 +0100
committerChristian Stenger <christian.stenger@digia.com>2014-01-29 13:50:57 +0100
commit06d34f5a12a55e7831b1c4a5e5edf495a10a681e (patch)
tree52cb5b88cee772ffcf274266a1aa5468999e60f7
parent4dbf2702e0b76b5e08a3f1e4faef803bc6176cb9 (diff)
downloadqt-creator-06d34f5a12a55e7831b1c4a5e5edf495a10a681e.tar.gz
Squish: Unify hack for invoking context menu items on Mac
Change-Id: I7e4d1cb00ea75e1aa33fa20b30744ffd56f002de Reviewed-by: Robert Loehning <robert.loehning@digia.com>
-rw-r--r--tests/system/shared/project_explorer.py5
-rw-r--r--tests/system/shared/workarounds.py29
-rw-r--r--tests/system/suite_tools/tst_designer_autocomplete/test.py10
-rw-r--r--tests/system/suite_tools/tst_designer_goto_slot/test.py6
4 files changed, 31 insertions, 19 deletions
diff --git a/tests/system/shared/project_explorer.py b/tests/system/shared/project_explorer.py
index 07f0fe6af8..f6f0a78635 100644
--- a/tests/system/shared/project_explorer.py
+++ b/tests/system/shared/project_explorer.py
@@ -301,10 +301,7 @@ def invokeContextMenuOnProject(projectName, menuItem):
str(projItem.text).replace("_", "\\_").replace(".", "\\."), 5, 5, 0)
# 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):
- activateItem(waitForObjectItem(obj, menuItem))
- break
+ waitFor("macHackActivateContextMenuItem(menuItem)", 6000)
else:
activateItem(waitForObjectItem("{name='Project.Menu.Project' type='QMenu' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}", menuItem))
diff --git a/tests/system/shared/workarounds.py b/tests/system/shared/workarounds.py
index 05a413eb57..f1cef9a2b8 100644
--- a/tests/system/shared/workarounds.py
+++ b/tests/system/shared/workarounds.py
@@ -30,6 +30,35 @@
import urllib2
import re
+############ functions not related to issues tracked inside jira ############
+
+def __checkWithoutWidget__(*args):
+ return className(args[0]) == 'QMenu' and args[0].visible
+
+def __checkWithWidget__(*args):
+ return (__checkWithoutWidget__(args[0])
+ and widgetContainsPoint(waitForObject(args[1]), args[0].mapToGlobal(QPoint(0 ,0))))
+
+# hack for activating context menus on Mac because of Squish5/Qt5.2 problems
+# param item a string holding the menu item to invoke (just the label)
+# param widget an object; if provided there will be an additional check if the menu's top left
+# corner is placed on this widget
+def macHackActivateContextMenuItem(item, widget=None):
+ if widget:
+ func = __checkWithWidget__
+ else:
+ func = __checkWithoutWidget__
+ for obj in object.topLevelObjects():
+ try:
+ if func(obj, widget):
+ activateItem(waitForObjectItem(obj, item))
+ return True
+ except:
+ pass
+ return False
+
+################ workarounds for issues tracked inside jira #################
+
JIRA_URL='https://bugreports.qt-project.org/browse'
class JIRA:
diff --git a/tests/system/suite_tools/tst_designer_autocomplete/test.py b/tests/system/suite_tools/tst_designer_autocomplete/test.py
index 25ebf5865d..fe3f7896d4 100644
--- a/tests/system/suite_tools/tst_designer_autocomplete/test.py
+++ b/tests/system/suite_tools/tst_designer_autocomplete/test.py
@@ -29,16 +29,6 @@
source("../../shared/qtcreator.py")
-def macHackActivateContextMenuItem(item):
- for obj in object.topLevelObjects():
- try:
- if className(obj) == 'QMenu' and obj.visible:
- activateItem(waitForObjectItem(obj, item))
- return True
- except:
- pass
- return False
-
def main():
startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError():
diff --git a/tests/system/suite_tools/tst_designer_goto_slot/test.py b/tests/system/suite_tools/tst_designer_goto_slot/test.py
index b6d73bdefb..e11d0afb1d 100644
--- a/tests/system/suite_tools/tst_designer_goto_slot/test.py
+++ b/tests/system/suite_tools/tst_designer_goto_slot/test.py
@@ -49,11 +49,7 @@ def main():
openContextMenu(waitForObject(con[0]), 5, 5, 0)
# hack for Squish 5/Qt5.2 problems of handling menus on Mac - remove asap
if platform.system() == 'Darwin':
- for obj in object.topLevelObjects():
- if (className(obj) == 'QMenu' and obj.visible
- and widgetContainsPoint(waitForObject(con[0]), obj.mapToGlobal(QPoint(0, 0)))):
- activateItem(obj, "Go to slot...")
- break
+ waitFor("macHackActivateContextMenuItem('Go to slot...', con[0])", 6000)
else:
activateItem(waitForObjectItem("{type='QMenu' unnamed='1' visible='1'}", "Go to slot..."))
waitForObjectItem(":Select signal.signalList_QTreeWidget", con[1])