From 5c1b8dee32cae5ca55a280c75e5a4bf2d53b3ea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Wed, 26 Jul 2023 16:19:57 +0200 Subject: [PATCH] SquishTests: Simplify and stabilize special handling of Mac menus - Check condition only once - Make sure correct length is being used Change-Id: I8c9627d91b4f022d60bae039c0478248cc30d183 Reviewed-by: Christian Stenger --- tests/system/shared/utils.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index 77b493b32a0..be1f474c6e7 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -171,11 +171,13 @@ 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:] + hasNumPrefix = subItem.startswith(numberedPrefix) + if hasNumPrefix and platform.system() == 'Darwin': + # on macOS we don't add these prefixes + subItem = subItem[len(numberedPrefix):] + hasNumPrefix = False - if subItem.startswith(numberedPrefix): + if hasNumPrefix: triggered = False for i in range(1, 10): try: