Squish: Fix some Mac/Squish issues

Details:
* wrong shortcut usage replaced
* timing issues fixed
* re-used the editor-focus-on-mac workaround for some tests

Change-Id: Ie0d65d941c999d545bd50e1cf4794624c4110247
Reviewed-by: Robert Loehning <robert.loehning@digia.com>
This commit is contained in:
Christian Stenger
2013-02-11 17:29:08 +01:00
parent a8db5984be
commit 80263a5221
4 changed files with 11 additions and 6 deletions
+5 -3
View File
@@ -46,7 +46,7 @@ def placeCursorToLine(editor, line, isRegex=False):
def menuVisibleAtEditor(editor, menuInList):
menuInList[0] = None
try:
menu = waitForObject("{type='QMenu' unnamed='1' visible='1'}", 200)
menu = waitForObject("{type='QMenu' unnamed='1' visible='1'}", 500)
success = menu.visible and widgetContainsPoint(editor, menu.mapToGlobal(QPoint(0, 0)))
if success:
menuInList[0] = menu
@@ -63,6 +63,8 @@ def widgetContainsPoint(widget, point):
# at the same position where the text cursor is located at
def openContextMenuOnTextCursorPosition(editor):
rect = editor.cursorRect(editor.textCursor())
if platform.system() == 'Darwin':
JIRA.performWorkaroundIfStillOpen(6918, JIRA.Bug.CREATOR, editor)
openContextMenu(editor, rect.x+rect.width/2, rect.y+rect.height/2, 0)
menuInList = [None]
waitFor("menuVisibleAtEditor(editor, menuInList)", 5000)
@@ -270,9 +272,9 @@ def validateSearchResult(expectedCount):
# this function invokes context menu and command from it
def invokeContextMenuItem(editorArea, command1, command2 = None):
ctxtMenu = openContextMenuOnTextCursorPosition(editorArea)
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), command1, 1000))
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), command1, 2000))
if command2:
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), command2, 1000))
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), command2, 2000))
# this function invokes the "Find Usages" item from context menu
# param editor an editor object
@@ -36,6 +36,8 @@ def main():
"Skipping this file for now.")
continue
if platform.system() == 'Darwin':
JIRA.performWorkaroundIfStillOpen(6918, JIRA.Bug.CREATOR, editor)
contentBefore = readFile(currentFile)
popupText = "The file %s was removed. Do you want to save it under a different name, or close the editor?"
os.remove(currentFile)
@@ -24,7 +24,7 @@ def testRenameMacroAfterSourceModification():
def __deleteAnyClass__():
global cppEditorStr
if platform.system() == 'Darwin':
type(cppEditorStr, "<Command+Left>")
type(cppEditorStr, "<Meta+Left>")
else:
type(cppEditorStr, "<Home>")
markText(cppEditorStr, "Down", 5)
@@ -50,7 +50,7 @@ def testRenameMacroAfterSourceMoving():
def __cut__():
global cppEditorStr
if platform.system() == 'Darwin':
type(cppEditorStr, "<Command+Left>")
type(cppEditorStr, "<Meta+Left>")
else:
type(cppEditorStr, "<Home>")
markText(cppEditorStr, "Down", 4)
@@ -27,7 +27,8 @@ def main():
test.fatal("Could not get the editor for '%s'" % currentFile,
"Skipping this file for now.")
continue
JIRA.performWorkaroundIfStillOpen(6918, JIRA.Bug.CREATOR, editor)
if platform.system() == 'Darwin':
JIRA.performWorkaroundIfStillOpen(6918, JIRA.Bug.CREATOR, editor)
for key in ["<Up>", "<Down>", "<Left>", "<Right>"]:
test.log("Selecting everything")
invokeMenuItem("Edit", "Select All")