Merge remote-tracking branch 'origin/2.5'

This commit is contained in:
Eike Ziller
2012-05-25 13:21:25 +02:00
14 changed files with 85 additions and 84 deletions

View File

@@ -35,7 +35,7 @@ def takeDebuggerLog():
return debuggerLog return debuggerLog
# function to set breakpoints for the current project # function to set breakpoints for the current project
# on the given file,line pairs inside the given dict # on the given file,line pairs inside the given list of dicts
# the lines are treated as regular expression # the lines are treated as regular expression
def setBreakpointsForCurrentProject(filesAndLines): def setBreakpointsForCurrentProject(filesAndLines):
# internal helper for setBreakpointsForCurrentProject # internal helper for setBreakpointsForCurrentProject
@@ -52,12 +52,13 @@ def setBreakpointsForCurrentProject(filesAndLines):
switchViewTo(ViewConstants.DEBUG) switchViewTo(ViewConstants.DEBUG)
removeOldBreakpoints() removeOldBreakpoints()
if not filesAndLines or not isinstance(filesAndLines, dict): if not filesAndLines or not isinstance(filesAndLines, (list,tuple)):
test.fatal("This function only takes a non-empty dict.") test.fatal("This function only takes a non-empty list/tuple holding dicts.")
return False return False
navTree = waitForObject("{type='Utils::NavigationTreeView' unnamed='1' visible='1' " navTree = waitForObject("{type='Utils::NavigationTreeView' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}", 20000) "window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
for curFile,curLine in filesAndLines.iteritems(): for current in filesAndLines:
for curFile,curLine in current.iteritems():
fName = __doubleClickFile__(navTree, curFile) fName = __doubleClickFile__(navTree, curFile)
editor = getEditorForFileSuffix(curFile) editor = getEditorForFileSuffix(curFile)
if not placeCursorToLine(editor, curLine, True): if not placeCursorToLine(editor, curLine, True):

View File

@@ -15,22 +15,13 @@ def placeCursorToLine(editor,line,isRegex=False):
regex = re.compile(line) regex = re.compile(line)
while not found: while not found:
currentLine = str(lineUnderCursor(editor)).strip() currentLine = str(lineUnderCursor(editor)).strip()
if isRegex: found = isRegex and regex.match(currentLine) or not isRegex and currentLine == line
if regex.match(currentLine): if not found:
found = True type(editor, "<Down>")
else: newPosition = editor.textCursor().position()
moveTextCursor(editor, QTextCursor.Down, QTextCursor.MoveAnchor) if oldPosition == newPosition:
if oldPosition==editor.textCursor().position():
break break
oldPosition = editor.textCursor().position() oldPosition = newPosition
else:
if currentLine==line:
found = True
else:
moveTextCursor(editor, QTextCursor.Down, QTextCursor.MoveAnchor)
if oldPosition==editor.textCursor().position():
break
oldPosition = editor.textCursor().position()
if not found: if not found:
test.fatal("Couldn't find line matching\n\n%s\n\nLeaving test..." % line) test.fatal("Couldn't find line matching\n\n%s\n\nLeaving test..." % line)
return False return False
@@ -39,21 +30,6 @@ def placeCursorToLine(editor,line,isRegex=False):
editor.setTextCursor(cursor) editor.setTextCursor(cursor)
return True return True
# this function moves the text cursor of an editor by using Qt internal functions
# this is more reliable (especially on Mac) than the type() approach
# param editor an editor object
# param moveOperation a value of enum MoveOperation (of QTextCursor)
# param moveAnchor a value of enum MoveMode (of QTextCursor)
# param n how often repeat the move operation?
def moveTextCursor(editor, moveOperation, moveAnchor, n=1):
if not editor or isinstance(editor, (str,unicode)):
test.fatal("Either got a NoneType or a string instead of an editor object")
return False
textCursor = editor.textCursor()
result = textCursor.movePosition(moveOperation, moveAnchor, n)
editor.setTextCursor(textCursor)
return result
# this function returns True if a QMenu is # this function returns True if a QMenu is
# popped up above the given editor # popped up above the given editor
# param editor is the editor where the menu should appear # param editor is the editor where the menu should appear

View File

@@ -375,7 +375,8 @@ def checkDebuggingLibrary(targVersion, targets):
# param keepOptionsOpen set to True if the Options dialog should stay open when # param keepOptionsOpen set to True if the Options dialog should stay open when
# leaving this function # leaving this function
# param additionalFunction pass a function or name of a defined function to execute # param additionalFunction pass a function or name of a defined function to execute
# for each item on the list of Qt versions # for each correctly configured item on the list of Qt versions
# (Qt versions having no assigned toolchain, failing qmake,... will be skipped)
# this function must take at least 2 parameters - the first is the target name # this function must take at least 2 parameters - the first is the target name
# and the second the version of the current selected Qt version item # and the second the version of the current selected Qt version item
# param argsForAdditionalFunc you can specify as much parameters as you want to pass # param argsForAdditionalFunc you can specify as much parameters as you want to pass
@@ -418,9 +419,11 @@ def iterateQtVersions(keepOptionsOpen=False, additionalFunction=None, *argsForAd
else: else:
currResult = additionalFunction(target, version, *argsForAdditionalFunc) currResult = additionalFunction(target, version, *argsForAdditionalFunc)
except: except:
import sys
t,v,tb = sys.exc_info()
currResult = None currResult = None
test.fatal("Function to additionally execute on Options Dialog could not be found or " test.fatal("Function to additionally execute on Options Dialog could not be found or "
"an exception occured while executing it.") "an exception occured while executing it.", "%s(%s)" % (str(t), str(v)))
additionalResult.append(currResult) additionalResult.append(currResult)
if not keepOptionsOpen: if not keepOptionsOpen:
clickButton(waitForObject(":Options.Cancel_QPushButton")) clickButton(waitForObject(":Options.Cancel_QPushButton"))

View File

@@ -14,7 +14,10 @@ def main():
# open example project # open example project
openQmakeProject(examplePath) openQmakeProject(examplePath)
# build and wait until finished - on all (except Qt 4.7.0 (would fail)) build configurations # build and wait until finished - on all (except Qt 4.7.0 (would fail)) build configurations
for config in iterateBuildConfigs(1, 0, "(?!.*4\.7\.0.*)"): availableConfigs = iterateBuildConfigs(1, 0, "(?!.*4\.7\.0.*)")
if not availableConfigs:
test.fatal("Haven't found a suitable Qt version (anything except Qt 4.7.0) - leaving without building.")
for config in availableConfigs:
selectBuildConfig(1, 0, config) selectBuildConfig(1, 0, config)
# try to build project # try to build project
test.log("Testing build configuration: " + config) test.log("Testing build configuration: " + config)

View File

@@ -16,8 +16,9 @@ def main():
"Verifying if error is properly reported") "Verifying if error is properly reported")
# repair error - go to written line # repair error - go to written line
placeCursorToLine(editorArea, testingCodeLine) placeCursorToLine(editorArea, testingCodeLine)
moveTextCursor(editorArea, QTextCursor.Left, QTextCursor.MoveAnchor, 14) for i in range(14):
moveTextCursor(editorArea, QTextCursor.Right, QTextCursor.KeepAnchor, 1) type(editorArea, "<Left>")
type(editorArea, "<Shift+Right>")
type(editorArea, "c") type(editorArea, "c")
# invoke QML parsing # invoke QML parsing
invokeMenuItem("Tools", "QML/JS", "Run Checks") invokeMenuItem("Tools", "QML/JS", "Run Checks")

View File

@@ -59,7 +59,8 @@ def main():
if not placeCursorToLine(editorArea, "Rectangle {"): if not placeCursorToLine(editorArea, "Rectangle {"):
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")
return return
moveTextCursor(editorArea, QTextCursor.Left, QTextCursor.MoveAnchor, 5) for i in range(5):
type(editorArea, "<Left>")
ctxtMenu = openContextMenuOnTextCursorPosition(editorArea) ctxtMenu = openContextMenuOnTextCursorPosition(editorArea)
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Find Usages")) activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Find Usages"))
# check if usage was properly found # check if usage was properly found
@@ -77,7 +78,8 @@ def main():
if not placeCursorToLine(editorArea, "anchors { left: parent.left; top: parent.top; right: parent.right; bottom: parent.verticalCenter }"): if not placeCursorToLine(editorArea, "anchors { left: parent.left; top: parent.top; right: parent.right; bottom: parent.verticalCenter }"):
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")
return return
moveTextCursor(editorArea, QTextCursor.Left, QTextCursor.MoveAnchor, 87) for i in range(87):
type(editorArea, "<Left>")
invokeMenuItem("Tools", "QML/JS", "Find Usages") invokeMenuItem("Tools", "QML/JS", "Find Usages")
# check if usage was properly found # check if usage was properly found
expectedResults = [ExpectedResult("color-animation.qml", 50, "anchors { left: parent.left; top: parent.top; right: parent.right; bottom: parent.verticalCenter }"), expectedResults = [ExpectedResult("color-animation.qml", 50, "anchors { left: parent.left; top: parent.top; right: parent.right; bottom: parent.verticalCenter }"),
@@ -94,7 +96,8 @@ def main():
if not placeCursorToLine(editorArea, "SequentialAnimation on opacity {"): if not placeCursorToLine(editorArea, "SequentialAnimation on opacity {"):
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")
return return
moveTextCursor(editorArea, QTextCursor.Left, QTextCursor.MoveAnchor, 5) for i in range(5):
type(editorArea, "<Left>")
type(editorArea, "<Ctrl+Shift+U>") type(editorArea, "<Ctrl+Shift+U>")
# check if usage was properly found # check if usage was properly found
expectedResults = [ExpectedResult("color-animation.qml", 87, "SequentialAnimation on opacity {")] expectedResults = [ExpectedResult("color-animation.qml", 87, "SequentialAnimation on opacity {")]

View File

@@ -5,7 +5,8 @@ def main():
editorArea = startQtCreatorWithNewAppAtQMLEditor(projectDir, "SampleApp", "Text {") editorArea = startQtCreatorWithNewAppAtQMLEditor(projectDir, "SampleApp", "Text {")
if not editorArea: if not editorArea:
return return
moveTextCursor(editorArea, QTextCursor.Left, QTextCursor.MoveAnchor, 5) for i in range(5):
type(editorArea, "<Left>")
# invoke Refactoring - Move Component into separate file # invoke Refactoring - Move Component into separate file
ctxtMenu = openContextMenuOnTextCursorPosition(editorArea) ctxtMenu = openContextMenuOnTextCursorPosition(editorArea)
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Refactoring")) activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Refactoring"))

View File

@@ -4,12 +4,17 @@ def main():
editorArea = startQtCreatorWithNewAppAtQMLEditor(tempDir(), "SampleApp", "Text {") editorArea = startQtCreatorWithNewAppAtQMLEditor(tempDir(), "SampleApp", "Text {")
if not editorArea: if not editorArea:
return return
moveTextCursor(editorArea, QTextCursor.StartOfLine, QTextCursor.MoveAnchor) homeKey = "<Home>"
if platform.system() == "Darwin":
homeKey = "<Ctrl+Left>"
for i in range(2):
type(editorArea, homeKey)
type(editorArea, "<Return>") type(editorArea, "<Return>")
moveTextCursor(editorArea, QTextCursor.Up, QTextCursor.MoveAnchor) type(editorArea, "<Up>")
type(editorArea, "<Tab>") type(editorArea, "<Tab>")
type(editorArea, "Item { x: 10; y: 20; width: 10 }") type(editorArea, "Item { x: 10; y: 20; width: 10 }")
moveTextCursor(editorArea, QTextCursor.Left, QTextCursor.MoveAnchor, 30) for i in range(30):
type(editorArea, "<Left>")
invokeMenuItem("File", "Save All") invokeMenuItem("File", "Save All")
# activate menu and apply 'Refactoring - Split initializer' # activate menu and apply 'Refactoring - Split initializer'
numLinesExpected = len(str(editorArea.plainText).splitlines()) + 4 numLinesExpected = len(str(editorArea.plainText).splitlines()) + 4
@@ -20,16 +25,9 @@ def main():
waitFor("len(str(editorArea.plainText).splitlines()) == numLinesExpected", 5000) waitFor("len(str(editorArea.plainText).splitlines()) == numLinesExpected", 5000)
# verify if refactoring was properly applied - each part on separate line # verify if refactoring was properly applied - each part on separate line
verifyMessage = "Verifying split initializer functionality at element line." verifyMessage = "Verifying split initializer functionality at element line."
verifyCurrentLine(editorArea, "Item {", verifyMessage) for line in ["Item {", "x: 10;", "y: 20;", "width: 10", "}"]:
moveTextCursor(editorArea, QTextCursor.Down, QTextCursor.MoveAnchor, 1) verifyCurrentLine(editorArea, line, verifyMessage)
verifyCurrentLine(editorArea, "x: 10;", verifyMessage) type(editorArea, "<Down>")
moveTextCursor(editorArea, QTextCursor.Down, QTextCursor.MoveAnchor, 1)
verifyCurrentLine(editorArea, "y: 20;", verifyMessage)
moveTextCursor(editorArea, QTextCursor.Down, QTextCursor.MoveAnchor, 1)
verifyCurrentLine(editorArea, "width: 10", verifyMessage)
moveTextCursor(editorArea, QTextCursor.Down, QTextCursor.MoveAnchor, 1)
verifyCurrentLine(editorArea, "}", verifyMessage)
moveTextCursor(editorArea, QTextCursor.Down, QTextCursor.MoveAnchor, 1)
#save and exit #save and exit
invokeMenuItem("File", "Save All") invokeMenuItem("File", "Save All")
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")

View File

@@ -7,7 +7,10 @@ def main():
# create qt quick application # create qt quick application
createNewQtQuickApplication(tempDir(), "SampleApp") createNewQtQuickApplication(tempDir(), "SampleApp")
# build it - on all (except Qt 4.7.0 (would fail)) build configurations # build it - on all (except Qt 4.7.0 (would fail)) build configurations
for config in iterateBuildConfigs(1, 0, "(?!.*4\.7\.0.*)"): availableConfigs = iterateBuildConfigs(1, 0, "(?!.*4\.7\.0.*)")
if not availableConfigs:
test.fatal("Haven't found a suitable Qt version (anything except Qt 4.7.0) - leaving without building.")
for config in availableConfigs:
selectBuildConfig(1, 0, config) selectBuildConfig(1, 0, config)
# try to compile # try to compile
test.log("Testing build configuration: " + config) test.log("Testing build configuration: " + config)

View File

@@ -17,7 +17,10 @@ def main():
# save all # save all
invokeMenuItem("File", "Save All") invokeMenuItem("File", "Save All")
# build it - on all (except Qt 4.7.0 (would fail)) build configurations # build it - on all (except Qt 4.7.0 (would fail)) build configurations
for config in iterateBuildConfigs(1, 0, "(?!.*4\.7\.0.*)"): availableConfigs = iterateBuildConfigs(1, 0, "(?!.*4\.7\.0.*)")
if not availableConfigs:
test.fatal("Haven't found a suitable Qt version (anything except Qt 4.7.0) - leaving without building.")
for config in availableConfigs:
selectBuildConfig(1, 0, config) selectBuildConfig(1, 0, config)
# try to compile # try to compile
test.log("Testing build configuration: " + config) test.log("Testing build configuration: " + config)

View File

@@ -6,7 +6,10 @@ project = "SquishProject"
def main(): def main():
startApplication("qtcreator" + SettingsPath) startApplication("qtcreator" + SettingsPath)
createProject_Qt_Console(projectsPath, project) createProject_Qt_Console(projectsPath, project)
for config in iterateBuildConfigs(1, 0): availableConfigs = iterateBuildConfigs(1, 0)
if not availableConfigs:
test.fatal("Haven't found a suitable Qt version - leaving without building.")
for config in availableConfigs:
selectBuildConfig(1, 0, config) selectBuildConfig(1, 0, config)
test.log("Testing build configuration: " + config) test.log("Testing build configuration: " + config)
runAndCloseApp() runAndCloseApp()

View File

@@ -37,7 +37,10 @@ def main():
test.verify("CONFIG += console" in str(proEditor.plainText), "Verifying that program is configured with console") test.verify("CONFIG += console" in str(proEditor.plainText), "Verifying that program is configured with console")
setRunInTerminal(1, 0, False) setRunInTerminal(1, 0, False)
for config in iterateBuildConfigs(1, 0): availableConfigs = iterateBuildConfigs(1, 0)
if not availableConfigs:
test.fatal("Haven't found a suitable Qt version - leaving without building.")
for config in availableConfigs:
selectBuildConfig(1, 0, config) selectBuildConfig(1, 0, config)
test.log("Testing build configuration: " + config) test.log("Testing build configuration: " + config)

View File

@@ -25,10 +25,10 @@ def main():
'running: true', 'running: true',
'onTriggered: console.log("Break here")']) 'onTriggered: console.log("Break here")'])
invokeMenuItem("File", "Save All") invokeMenuItem("File", "Save All")
filesAndLines = { filesAndLines = [
"%s.QML.qml/%s.main\\.qml" % (projectName,projectName) : 'onTriggered:.*', { "%s.QML.qml/%s.main\\.qml" % (projectName,projectName) : 'onTriggered.*' },
"%s.Sources.main\\.cpp" % projectName : "viewer.setOrientation\\(.+\\);" { "%s.Sources.main\\.cpp" % projectName : "viewer.setOrientation\\(.+\\);" }
} ]
test.log("Setting breakpoints") test.log("Setting breakpoints")
result = setBreakpointsForCurrentProject(filesAndLines) result = setBreakpointsForCurrentProject(filesAndLines)
if result: if result:

View File

@@ -27,7 +27,10 @@ def main():
fancyToolButton = waitForObject(":*Qt Creator_Core::Internal::FancyToolButton") fancyToolButton = waitForObject(":*Qt Creator_Core::Internal::FancyToolButton")
qtVerPattern = re.compile("\d\.\d(\.\d+)?") qtVerPattern = re.compile("\d\.\d(\.\d+)?")
for config in iterateBuildConfigs(1, 0, "(Desktop )?Qt.*Release"): availableConfigs = iterateBuildConfigs(1, 0, "(Desktop )?Qt.*Release")
if not availableConfigs:
test.fatal("Haven't found a suitable Qt version (need Release build) - leaving without building.")
for config in availableConfigs:
qtVersion = qtVerPattern.search(config) qtVersion = qtVerPattern.search(config)
if qtVersion: if qtVersion:
qtVersion = qtVersion.group() qtVersion = qtVersion.group()