Squish: Use Locator instead of menu hack

Change-Id: I4e84a52fb6ad4c93ef53bb1a17639fd8b263b987
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Robert Loehning
2018-05-03 18:05:20 +02:00
parent 1f1be70546
commit 06c2e69301
3 changed files with 20 additions and 42 deletions
+4 -15
View File
@@ -176,21 +176,10 @@ def invokeMenuItem(menu, item, *subItems):
waitForObject(":Qt Creator.QtCreator.MenuBar_QMenuBar", 2000)
except:
nativeMouseClick(waitForObject(":Qt Creator_Core::Internal::MainWindow", 1000), 20, 20, 0, Qt.LeftButton)
# HACK as Squish fails to provide a proper way to access the system menu
if platform.system() == "Darwin":
if menu == "Tools" and item == "Options...":
#nativeType("<Command+,>")
# the following is a pure HACK because using the default key sequence seems to be broken
# when running from inside Squish
menuBar = waitForObject(":Qt Creator.QtCreator.MenuBar_QMenuBar", 500)
nativeMouseClick(menuBar, 75, 5, 0, Qt.LeftButton)
for _ in range(3):
nativeType("<Down>")
nativeType("<Return>")
return
if menu == "File" and item == "Exit":
nativeType("<Command+q>")
return
# Use Locator for menu items which wouldn't work on macOS
if menu == "Tools" and item == "Options..." or menu == "File" and item == "Exit":
selectFromLocator("t %s" % item, item)
return
menuObject = waitForObjectItem(":Qt Creator.QtCreator.MenuBar_QMenuBar", menu)
snooze(1)
waitFor("menuObject.visible", 1000)