Squish: Update for running tst_generic_highlighter

Change-Id: I262fb7a7223e235708cbc7e8e382a2448a2f8c84
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Robert Löhning
2021-10-22 21:29:22 +02:00
parent 78a1beb06e
commit 5ba3eb7fcf
2 changed files with 7 additions and 10 deletions

View File

@@ -190,22 +190,19 @@ def invokeMenuItem(menu, item, *subItems):
itemObject = waitForObjectItem(objectMap.realName(menuObject), item)
waitFor("itemObject.enabled", 2000)
activateItem(itemObject)
numberedPrefix = "(&\\d \| )?"
numberedPrefix = "%d | "
for subItem in subItems:
# we might have numbered sub items (e.g. "Recent Files") - these have this special prefix
if subItem.startswith(numberedPrefix):
# TODO: Find fix for Qt 6
actions = sub.actions()
triggered = False
for i in range(actions.count()):
current = actions.at(i)
nonPrefix = subItem[len(numberedPrefix):]
matcher = re.match("%s(.*)" % numberedPrefix, str(current.text))
if matcher and matcher.group(2) == nonPrefix:
itemObject = current
for i in range(1, 10):
try:
itemObject = waitForObjectItem(itemObject, subItem % i, 1000)
activateItem(itemObject)
triggered = True
break
except:
continue
if not triggered:
test.fail("Could not trigger '%s' - item missing or code wrong?" % subItem,
"Function arguments: '%s', '%s', %s" % (menu, item, str(subItems)))

View File

@@ -199,7 +199,7 @@ def main():
recentFile = os.path.join(folder, current)
if recentFile.startswith(home) and platform.system() in ('Linux', 'Darwin'):
recentFile = recentFile.replace(home, "~", 1)
invokeMenuItem("File", "Recent Files", "(&\\d \| )?%s" % recentFile)
invokeMenuItem("File", "Recent Files", "%d | " + recentFile)
editor = getEditorForFileSuffix(current)
display = displayHintForHighlighterDefinition(current, patterns, lPatterns,
addedHaskell, addedLiterateHaskell)