Squish: Prepare tst_CCOM01 for Qt5

Change-Id: Ic2806673cb65018000bcbe6ae66dad1b2f555e39
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
Robert Loehning
2013-03-28 16:58:25 +01:00
parent 7f0ff88c61
commit 003821f936
3 changed files with 33 additions and 15 deletions

View File

@@ -311,3 +311,31 @@ def openDocument(treeElement):
return True
except:
return False
def earlyExit(details="No additional information"):
test.fail("Something went wrong running this test", details)
invokeMenuItem("File", "Save All")
invokeMenuItem("File", "Exit")
def openDocumentPlaceCursor(doc, line, additionalFunction=None):
cppEditorStr = ":Qt Creator_CppEditor::Internal::CPPEditorWidget"
if openDocument(doc) and placeCursorToLine(cppEditorStr, line):
if additionalFunction:
additionalFunction()
return str(waitForObject(cppEditorStr).plainText)
else:
earlyExit("Open %s or placing cursor to line (%s) failed." % (doc, line))
return None
# Replaces a line in the editor with another
# param fileSpec a string specifying a file in Projects view
# param oldLine a string holding the line to be replaced
# param newLine a string holding the line to be inserted
def replaceLine(fileSpec, oldLine, newLine):
if openDocumentPlaceCursor(fileSpec, oldLine) == None:
return False
editor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
for i in range(len(oldLine)):
type(editor, "<Backspace>")
type(editor, newLine)
return True