Skip to content

Commit

Permalink
Squish: Fix menu handling on macOS
Browse files Browse the repository at this point in the history
Some menus inside QC have special numbering - but this only
applies to Linux and Windows. On macOS we do not add this
special numbering.
Additionally this patch stabilizes the triggering of
submenus. When they get triggered it takes a split of a
second until the items inside the menu are usable.
Let squish wait until the sub menu is fully present before
trying to activate some of its items.

Change-Id: I32c688a937ada1da07506d4ebd22730e4f2bcaef
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
  • Loading branch information
Christian Stenger committed Jul 18, 2023
1 parent c0b29f2 commit a86356c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/system/shared/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ def invokeMenuItem(menu, item, *subItems):
numberedPrefix = "%d | "
for subItem in subItems:
# we might have numbered sub items (e.g. "Recent Files") - these have this special prefix
# but on macOS we don't add these prefixes
if platform.system() == 'Darwin' and subItem.startswith(numberedPrefix):
subItem = subItem[5:]

if subItem.startswith(numberedPrefix):
triggered = False
for i in range(1, 10):
Expand All @@ -186,7 +190,10 @@ def invokeMenuItem(menu, item, *subItems):
"Function arguments: '%s', '%s', %s" % (menu, item, str(subItems)))
break # we failed to trigger - no need to process subItems further
else:
noAmpersandItem = item.replace('&', '')
waitForObject("{type='QMenu' title='%s'}" % noAmpersandItem, 2000)
itemObject = waitForObjectItem(itemObject, subItem)
waitFor("itemObject.enabled", 2000)
activateItem(itemObject)


Expand Down

0 comments on commit a86356c

Please sign in to comment.