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 return True
except: except:
return False 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

View File

@@ -16,6 +16,11 @@ def main():
return return
# open example project # open example project
checkedTargets = openQmakeProject(examplePath) checkedTargets = openQmakeProject(examplePath)
if not replaceLine("propertyanimation.Sources.main\\.cpp",
"#include <QtGui/QApplication>",
"#include <QApplication>"):
return
invokeMenuItem("File", "Save All")
# build and wait until finished - on all build configurations # build and wait until finished - on all build configurations
availableConfigs = iterateBuildConfigs(len(checkedTargets)) availableConfigs = iterateBuildConfigs(len(checkedTargets))
if not availableConfigs: if not availableConfigs:

View File

@@ -90,16 +90,6 @@ def testRenameMacroAfterSourceMoving():
revertChanges(formerTexts) revertChanges(formerTexts)
return True return True
def openDocumentPlaceCursor(doc, line, additionalFunction=None):
global cppEditorStr
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." % (simpleFileName(doc), line))
return None
def performMacroRenaming(newMacroName): def performMacroRenaming(newMacroName):
for i in range(10): for i in range(10):
type(cppEditorStr, "<Left>") type(cppEditorStr, "<Left>")
@@ -150,8 +140,3 @@ def revertChanges(files):
def simpleFileName(navigatorFileName): def simpleFileName(navigatorFileName):
return ".".join(navigatorFileName.split(".")[-2:]).replace("\\","") return ".".join(navigatorFileName.split(".")[-2:]).replace("\\","")
def earlyExit(details="No additional information"):
test.fail("Something went wrong running this test", details)
invokeMenuItem("File", "Save All")
invokeMenuItem("File", "Exit")