forked from qt-creator/qt-creator
Squish: Fix invoking context menu sub items
Change-Id: I7d498ac3d4e2e2d25b3c504a95f96e434d0d1619 Reviewed-by: Robert Loehning <robert.loehning@digia.com> Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
committed by
Christian Stenger
parent
c937226db1
commit
7c9d2e3a1a
@@ -30,8 +30,7 @@ def takeDebuggerLog():
|
||||
debuggerLogWindow = waitForObject("{container=':DebugModeWidget.Debugger Log_QDockWidget' type='Debugger::Internal::CombinedPane' unnamed='1' visible='1'}")
|
||||
debuggerLog = str(debuggerLogWindow.plainText)
|
||||
mouseClick(debuggerLogWindow, 5, 5, 0, Qt.LeftButton)
|
||||
activateItem(waitForObjectItem(openContextMenuOnTextCursorPosition(debuggerLogWindow),
|
||||
"Clear Contents"))
|
||||
invokeContextMenuItem(debuggerLogWindow, "Clear Contents")
|
||||
waitFor("str(debuggerLogWindow.plainText)==''", 5000)
|
||||
invokeMenuItem("Window", "Views", "Debugger Log")
|
||||
return debuggerLog
|
||||
|
||||
@@ -274,7 +274,8 @@ def invokeContextMenuItem(editorArea, command1, command2 = None):
|
||||
ctxtMenu = openContextMenuOnTextCursorPosition(editorArea)
|
||||
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), command1, 2000))
|
||||
if command2:
|
||||
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), command2, 2000))
|
||||
activateItem(waitForObjectItem("{type='QMenu' visible='1' window=%s}"
|
||||
% objectMap.realName(ctxtMenu), command2, 2000))
|
||||
|
||||
# this function invokes the "Find Usages" item from context menu
|
||||
# param editor an editor object
|
||||
|
||||
@@ -60,8 +60,7 @@ def main():
|
||||
return
|
||||
for i in range(5):
|
||||
type(editorArea, "<Left>")
|
||||
ctxtMenu = openContextMenuOnTextCursorPosition(editorArea)
|
||||
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Find Usages"))
|
||||
invokeContextMenuItem(editorArea, "Find Usages")
|
||||
# check if usage was properly found
|
||||
expectedResults = [ExpectedResult("color-animation.qml", 49, "Rectangle {"),
|
||||
ExpectedResult("color-animation.qml", 96, "Rectangle {"),
|
||||
|
||||
@@ -8,9 +8,7 @@ def main():
|
||||
for i in range(5):
|
||||
type(editorArea, "<Left>")
|
||||
# invoke Refactoring - Move Component into separate file
|
||||
ctxtMenu = openContextMenuOnTextCursorPosition(editorArea)
|
||||
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Refactoring"))
|
||||
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Move Component into Separate File"))
|
||||
invokeContextMenuItem(editorArea, "Refactoring", "Move Component into Separate File")
|
||||
# give component name and proceed
|
||||
replaceEditorContent(waitForObject(":Dialog.componentNameEdit_QLineEdit"), "MyComponent")
|
||||
clickButton(waitForObject(":Dialog.OK_QPushButton"))
|
||||
|
||||
@@ -18,9 +18,7 @@ def main():
|
||||
invokeMenuItem("File", "Save All")
|
||||
# activate menu and apply 'Refactoring - Split initializer'
|
||||
numLinesExpected = len(str(editorArea.plainText).splitlines()) + 4
|
||||
ctxtMenu = openContextMenuOnTextCursorPosition(editorArea)
|
||||
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Refactoring"))
|
||||
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Split Initializer"))
|
||||
invokeContextMenuItem(editorArea, "Refactoring", "Split Initializer")
|
||||
# wait until refactoring ended
|
||||
waitFor("len(str(editorArea.plainText).splitlines()) == numLinesExpected", 5000)
|
||||
# verify if refactoring was properly applied - each part on separate line
|
||||
|
||||
@@ -12,9 +12,7 @@ def main():
|
||||
invokeMenuItem("File", "Save All")
|
||||
# invoke Refactoring - Wrap Component in Loader
|
||||
numLinesExpected = len(str(editorArea.plainText).splitlines()) + 10
|
||||
ctxtMenu = openContextMenuOnTextCursorPosition(editorArea)
|
||||
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Refactoring"))
|
||||
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Wrap Component in Loader"))
|
||||
invokeContextMenuItem(editorArea, "Refactoring", "Wrap Component in Loader")
|
||||
# wait until refactoring ended
|
||||
waitFor("len(str(editorArea.plainText).splitlines()) >= numLinesExpected", 5000)
|
||||
# verify if refactoring was properly applied
|
||||
|
||||
@@ -11,9 +11,7 @@ def main():
|
||||
invokeMenuItem("File", "Save All")
|
||||
# invoke Refactoring - Add a message suppression comment.
|
||||
numLinesExpected = len(str(editorArea.plainText).splitlines()) + 1
|
||||
ctxtMenu = openContextMenuOnTextCursorPosition(editorArea)
|
||||
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Refactoring"))
|
||||
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Add a Comment to Suppress This Message"))
|
||||
invokeContextMenuItem(editorArea, "Refactoring", "Add a Comment to Suppress This Message")
|
||||
# wait until refactoring ended
|
||||
waitFor("len(str(editorArea.plainText).splitlines()) >= numLinesExpected", 5000)
|
||||
# verify if refactoring was properly applied
|
||||
|
||||
@@ -52,8 +52,7 @@ def testRenameId():
|
||||
return False
|
||||
type(editor, "<Down>")
|
||||
searchFinished = False
|
||||
ctxtMenu = openContextMenuOnTextCursorPosition(editor)
|
||||
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Rename Symbol Under Cursor"))
|
||||
invokeContextMenuItem(editor, "Rename Symbol Under Cursor")
|
||||
waitFor("searchFinished")
|
||||
type(waitForObject("{leftWidget={text='Replace with:' type='QLabel' unnamed='1' visible='1'} "
|
||||
"type='Find::Internal::WideEnoughLineEdit' unnamed='1' visible='1' "
|
||||
|
||||
Reference in New Issue
Block a user