Squish: Fix helper function for small resolutions

Depending on the screen size the context menu may be
oriented differently depending on the point where the
context menu had been triggered.

Change-Id: Iae3834283e8e34ed44e57237561f1367cdaae108
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
This commit is contained in:
Christian Stenger
2019-03-20 09:48:43 +01:00
parent 1656402605
commit 7483ad1f1d

View File

@@ -78,7 +78,10 @@ def menuVisibleAtEditor(editor, menuInList):
return True
return False
menu = waitForObject("{type='QMenu' unnamed='1' visible='1'}", 500)
success = menu.visible and widgetContainsPoint(editor, menu.mapToGlobal(QPoint(0, 0)))
topLeft = menu.mapToGlobal(QPoint(0, 0))
bottomLeft = menu.mapToGlobal(QPoint(0, menu.height))
success = menu.visible and (widgetContainsPoint(editor, topLeft)
or widgetContainsPoint(editor, bottomLeft))
if success:
menuInList[0] = menu
return success