forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/2.5'
This commit is contained in:
@@ -35,7 +35,7 @@ def takeDebuggerLog():
|
||||
return debuggerLog
|
||||
|
||||
# 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
|
||||
def setBreakpointsForCurrentProject(filesAndLines):
|
||||
# internal helper for setBreakpointsForCurrentProject
|
||||
@@ -52,12 +52,13 @@ def setBreakpointsForCurrentProject(filesAndLines):
|
||||
|
||||
switchViewTo(ViewConstants.DEBUG)
|
||||
removeOldBreakpoints()
|
||||
if not filesAndLines or not isinstance(filesAndLines, dict):
|
||||
test.fatal("This function only takes a non-empty dict.")
|
||||
if not filesAndLines or not isinstance(filesAndLines, (list,tuple)):
|
||||
test.fatal("This function only takes a non-empty list/tuple holding dicts.")
|
||||
return False
|
||||
navTree = waitForObject("{type='Utils::NavigationTreeView' unnamed='1' visible='1' "
|
||||
"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)
|
||||
editor = getEditorForFileSuffix(curFile)
|
||||
if not placeCursorToLine(editor, curLine, True):
|
||||
|
@@ -5,7 +5,7 @@ import re;
|
||||
# and goes to the end of the line
|
||||
# line can be a regex - but if so, remember to set isRegex to True
|
||||
# the function returns True if this went fine, False on error
|
||||
def placeCursorToLine(editor,line,isRegex=False):
|
||||
def placeCursorToLine(editor, line, isRegex=False):
|
||||
cursor = editor.textCursor()
|
||||
oldPosition = 0
|
||||
cursor.setPosition(oldPosition)
|
||||
@@ -15,45 +15,21 @@ def placeCursorToLine(editor,line,isRegex=False):
|
||||
regex = re.compile(line)
|
||||
while not found:
|
||||
currentLine = str(lineUnderCursor(editor)).strip()
|
||||
if isRegex:
|
||||
if regex.match(currentLine):
|
||||
found = True
|
||||
else:
|
||||
moveTextCursor(editor, QTextCursor.Down, QTextCursor.MoveAnchor)
|
||||
if oldPosition==editor.textCursor().position():
|
||||
found = isRegex and regex.match(currentLine) or not isRegex and currentLine == line
|
||||
if not found:
|
||||
type(editor, "<Down>")
|
||||
newPosition = editor.textCursor().position()
|
||||
if oldPosition == newPosition:
|
||||
break
|
||||
oldPosition = editor.textCursor().position()
|
||||
else:
|
||||
if currentLine==line:
|
||||
found = True
|
||||
else:
|
||||
moveTextCursor(editor, QTextCursor.Down, QTextCursor.MoveAnchor)
|
||||
if oldPosition==editor.textCursor().position():
|
||||
break
|
||||
oldPosition = editor.textCursor().position()
|
||||
oldPosition = newPosition
|
||||
if not found:
|
||||
test.fatal("Couldn't find line matching\n\n%s\n\nLeaving test..." % line)
|
||||
return False
|
||||
cursor=editor.textCursor()
|
||||
cursor = editor.textCursor()
|
||||
cursor.movePosition(QTextCursor.EndOfLine, QTextCursor.MoveAnchor)
|
||||
editor.setTextCursor(cursor)
|
||||
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
|
||||
# popped up above the given editor
|
||||
# param editor is the editor where the menu should appear
|
||||
|
@@ -375,7 +375,8 @@ def checkDebuggingLibrary(targVersion, targets):
|
||||
# param keepOptionsOpen set to True if the Options dialog should stay open when
|
||||
# leaving this function
|
||||
# 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
|
||||
# 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
|
||||
@@ -418,9 +419,11 @@ def iterateQtVersions(keepOptionsOpen=False, additionalFunction=None, *argsForAd
|
||||
else:
|
||||
currResult = additionalFunction(target, version, *argsForAdditionalFunc)
|
||||
except:
|
||||
import sys
|
||||
t,v,tb = sys.exc_info()
|
||||
currResult = None
|
||||
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)
|
||||
if not keepOptionsOpen:
|
||||
clickButton(waitForObject(":Options.Cancel_QPushButton"))
|
||||
|
@@ -14,7 +14,10 @@ def main():
|
||||
# open example project
|
||||
openQmakeProject(examplePath)
|
||||
# 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)
|
||||
# try to build project
|
||||
test.log("Testing build configuration: " + config)
|
||||
|
@@ -16,8 +16,9 @@ def main():
|
||||
"Verifying if error is properly reported")
|
||||
# repair error - go to written line
|
||||
placeCursorToLine(editorArea, testingCodeLine)
|
||||
moveTextCursor(editorArea, QTextCursor.Left, QTextCursor.MoveAnchor, 14)
|
||||
moveTextCursor(editorArea, QTextCursor.Right, QTextCursor.KeepAnchor, 1)
|
||||
for i in range(14):
|
||||
type(editorArea, "<Left>")
|
||||
type(editorArea, "<Shift+Right>")
|
||||
type(editorArea, "c")
|
||||
# invoke QML parsing
|
||||
invokeMenuItem("Tools", "QML/JS", "Run Checks")
|
||||
|
@@ -59,7 +59,8 @@ def main():
|
||||
if not placeCursorToLine(editorArea, "Rectangle {"):
|
||||
invokeMenuItem("File", "Exit")
|
||||
return
|
||||
moveTextCursor(editorArea, QTextCursor.Left, QTextCursor.MoveAnchor, 5)
|
||||
for i in range(5):
|
||||
type(editorArea, "<Left>")
|
||||
ctxtMenu = openContextMenuOnTextCursorPosition(editorArea)
|
||||
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Find Usages"))
|
||||
# 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 }"):
|
||||
invokeMenuItem("File", "Exit")
|
||||
return
|
||||
moveTextCursor(editorArea, QTextCursor.Left, QTextCursor.MoveAnchor, 87)
|
||||
for i in range(87):
|
||||
type(editorArea, "<Left>")
|
||||
invokeMenuItem("Tools", "QML/JS", "Find Usages")
|
||||
# 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 }"),
|
||||
@@ -94,7 +96,8 @@ def main():
|
||||
if not placeCursorToLine(editorArea, "SequentialAnimation on opacity {"):
|
||||
invokeMenuItem("File", "Exit")
|
||||
return
|
||||
moveTextCursor(editorArea, QTextCursor.Left, QTextCursor.MoveAnchor, 5)
|
||||
for i in range(5):
|
||||
type(editorArea, "<Left>")
|
||||
type(editorArea, "<Ctrl+Shift+U>")
|
||||
# check if usage was properly found
|
||||
expectedResults = [ExpectedResult("color-animation.qml", 87, "SequentialAnimation on opacity {")]
|
||||
|
@@ -5,7 +5,8 @@ def main():
|
||||
editorArea = startQtCreatorWithNewAppAtQMLEditor(projectDir, "SampleApp", "Text {")
|
||||
if not editorArea:
|
||||
return
|
||||
moveTextCursor(editorArea, QTextCursor.Left, QTextCursor.MoveAnchor, 5)
|
||||
for i in range(5):
|
||||
type(editorArea, "<Left>")
|
||||
# invoke Refactoring - Move Component into separate file
|
||||
ctxtMenu = openContextMenuOnTextCursorPosition(editorArea)
|
||||
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Refactoring"))
|
||||
|
@@ -4,12 +4,17 @@ def main():
|
||||
editorArea = startQtCreatorWithNewAppAtQMLEditor(tempDir(), "SampleApp", "Text {")
|
||||
if not editorArea:
|
||||
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>")
|
||||
moveTextCursor(editorArea, QTextCursor.Up, QTextCursor.MoveAnchor)
|
||||
type(editorArea, "<Up>")
|
||||
type(editorArea, "<Tab>")
|
||||
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")
|
||||
# activate menu and apply 'Refactoring - Split initializer'
|
||||
numLinesExpected = len(str(editorArea.plainText).splitlines()) + 4
|
||||
@@ -20,16 +25,9 @@ def main():
|
||||
waitFor("len(str(editorArea.plainText).splitlines()) == numLinesExpected", 5000)
|
||||
# verify if refactoring was properly applied - each part on separate line
|
||||
verifyMessage = "Verifying split initializer functionality at element line."
|
||||
verifyCurrentLine(editorArea, "Item {", verifyMessage)
|
||||
moveTextCursor(editorArea, QTextCursor.Down, QTextCursor.MoveAnchor, 1)
|
||||
verifyCurrentLine(editorArea, "x: 10;", verifyMessage)
|
||||
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)
|
||||
for line in ["Item {", "x: 10;", "y: 20;", "width: 10", "}"]:
|
||||
verifyCurrentLine(editorArea, line, verifyMessage)
|
||||
type(editorArea, "<Down>")
|
||||
#save and exit
|
||||
invokeMenuItem("File", "Save All")
|
||||
invokeMenuItem("File", "Exit")
|
||||
|
@@ -7,7 +7,10 @@ def main():
|
||||
# create qt quick application
|
||||
createNewQtQuickApplication(tempDir(), "SampleApp")
|
||||
# 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)
|
||||
# try to compile
|
||||
test.log("Testing build configuration: " + config)
|
||||
|
@@ -17,7 +17,10 @@ def main():
|
||||
# save all
|
||||
invokeMenuItem("File", "Save All")
|
||||
# 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)
|
||||
# try to compile
|
||||
test.log("Testing build configuration: " + config)
|
||||
|
@@ -6,7 +6,10 @@ project = "SquishProject"
|
||||
def main():
|
||||
startApplication("qtcreator" + SettingsPath)
|
||||
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)
|
||||
test.log("Testing build configuration: " + config)
|
||||
runAndCloseApp()
|
||||
|
@@ -37,7 +37,10 @@ def main():
|
||||
test.verify("CONFIG += console" in str(proEditor.plainText), "Verifying that program is configured with console")
|
||||
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)
|
||||
test.log("Testing build configuration: " + config)
|
||||
|
||||
|
@@ -25,10 +25,10 @@ def main():
|
||||
'running: true',
|
||||
'onTriggered: console.log("Break here")'])
|
||||
invokeMenuItem("File", "Save All")
|
||||
filesAndLines = {
|
||||
"%s.QML.qml/%s.main\\.qml" % (projectName,projectName) : 'onTriggered:.*',
|
||||
"%s.Sources.main\\.cpp" % projectName : "viewer.setOrientation\\(.+\\);"
|
||||
}
|
||||
filesAndLines = [
|
||||
{ "%s.QML.qml/%s.main\\.qml" % (projectName,projectName) : 'onTriggered.*' },
|
||||
{ "%s.Sources.main\\.cpp" % projectName : "viewer.setOrientation\\(.+\\);" }
|
||||
]
|
||||
test.log("Setting breakpoints")
|
||||
result = setBreakpointsForCurrentProject(filesAndLines)
|
||||
if result:
|
||||
|
@@ -27,7 +27,10 @@ def main():
|
||||
fancyToolButton = waitForObject(":*Qt Creator_Core::Internal::FancyToolButton")
|
||||
|
||||
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)
|
||||
if qtVersion:
|
||||
qtVersion = qtVersion.group()
|
||||
|
Reference in New Issue
Block a user