Squish: Removed pointless explicit timeouts

Change-Id: I21e41fc8d1c26186afe0d18613c764abd065227e
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
Robert Loehning
2012-11-02 19:34:38 +01:00
parent fb61be5ed6
commit 77313fd980
9 changed files with 52 additions and 52 deletions

View File

@@ -68,7 +68,7 @@ def checkLastBuild(expectedToFail=False):
test.fail("Errors: %s | Warnings: %s" % (errors, warnings)) test.fail("Errors: %s | Warnings: %s" % (errors, warnings))
# additional stuff - could be removed... or improved :) # additional stuff - could be removed... or improved :)
ensureChecked(":Qt Creator_Issues_Core::Internal::OutputPaneToggleButton") ensureChecked(":Qt Creator_Issues_Core::Internal::OutputPaneToggleButton")
list=waitForObject(":Qt Creator.Issues_QListView", 20000) list=waitForObject(":Qt Creator.Issues_QListView")
model = list.model() model = list.model()
test.log("Rows inside issues: %d" % model.rowCount()) test.log("Rows inside issues: %d" % model.rowCount())
if gotErrors and createTasksFileOnError: if gotErrors and createTasksFileOnError:
@@ -78,7 +78,7 @@ def checkLastBuild(expectedToFail=False):
# helper function to check the compilation when build wasn't successful # helper function to check the compilation when build wasn't successful
def checkCompile(): def checkCompile():
ensureChecked(":Qt Creator_CompileOutput_Core::Internal::OutputPaneToggleButton") ensureChecked(":Qt Creator_CompileOutput_Core::Internal::OutputPaneToggleButton")
output = waitForObject(":Qt Creator.Compile Output_Core::OutputWindow", 20000) output = waitForObject(":Qt Creator.Compile Output_Core::OutputWindow")
waitFor("len(str(output.plainText))>0",5000) waitFor("len(str(output.plainText))>0",5000)
success = str(output.plainText).endswith("exited normally.") success = str(output.plainText).endswith("exited normally.")
if success: if success:
@@ -141,7 +141,7 @@ def iterateBuildConfigs(kitCount, filter = ""):
configs = [] configs = []
for currentKit in range(kitCount): for currentKit in range(kitCount):
switchToBuildOrRunSettingsFor(kitCount, currentKit, ProjectSettings.BUILD) switchToBuildOrRunSettingsFor(kitCount, currentKit, ProjectSettings.BUILD)
model = waitForObject(":scrollArea.Edit build configuration:_QComboBox", 20000).model() model = waitForObject(":scrollArea.Edit build configuration:_QComboBox").model()
prog = re.compile(filter) prog = re.compile(filter)
# for each row in the model, write its data to a list # for each row in the model, write its data to a list
configNames = dumpItems(model) configNames = dumpItems(model)

View File

@@ -19,7 +19,7 @@ def handleDebuggerWarnings(config):
pass # No warning. Fine. pass # No warning. Fine.
else: else:
if "Release" in config and not platform.system() in ("Darwin", "Microsoft", "Windows"): if "Release" in config and not platform.system() in ("Darwin", "Microsoft", "Windows"):
message = waitForObject("{container=':Qt Creator.DebugModeWidget_QSplitter' name='qt_msgbox_label' type='QLabel' visible='1'}", 20000) message = waitForObject("{container=':Qt Creator.DebugModeWidget_QSplitter' name='qt_msgbox_label' type='QLabel' visible='1'}")
messageText = str(message.text) messageText = str(message.text)
test.verify(messageText.startswith('This does not seem to be a "Debug" build.\nSetting breakpoints by file name and line number may fail.'), test.verify(messageText.startswith('This does not seem to be a "Debug" build.\nSetting breakpoints by file name and line number may fail.'),
"Got warning: %s" % messageText) "Got warning: %s" % messageText)
@@ -27,7 +27,7 @@ def handleDebuggerWarnings(config):
def takeDebuggerLog(): def takeDebuggerLog():
invokeMenuItem("Window", "Views", "Debugger Log") invokeMenuItem("Window", "Views", "Debugger Log")
debuggerLogWindow = waitForObject("{container=':DebugModeWidget.Debugger Log_QDockWidget' type='Debugger::Internal::CombinedPane' unnamed='1' visible='1'}", 20000) debuggerLogWindow = waitForObject("{container=':DebugModeWidget.Debugger Log_QDockWidget' type='Debugger::Internal::CombinedPane' unnamed='1' visible='1'}")
debuggerLog = str(debuggerLogWindow.plainText) debuggerLog = str(debuggerLogWindow.plainText)
mouseClick(debuggerLogWindow, 5, 5, 0, Qt.LeftButton) mouseClick(debuggerLogWindow, 5, 5, 0, Qt.LeftButton)
activateItem(waitForObjectItem(openContextMenuOnTextCursorPosition(debuggerLogWindow), activateItem(waitForObjectItem(openContextMenuOnTextCursorPosition(debuggerLogWindow),
@@ -58,7 +58,7 @@ def setBreakpointsForCurrentProject(filesAndLines):
test.fatal("This function only takes a non-empty list/tuple holding dicts.") 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'}")
for current in filesAndLines: for current in filesAndLines:
for curFile,curLine in current.iteritems(): for curFile,curLine in current.iteritems():
fName = __doubleClickFile__(navTree, curFile) fName = __doubleClickFile__(navTree, curFile)
@@ -180,7 +180,7 @@ def __startDebugger__(config):
def __stopDebugger__(): def __stopDebugger__():
clickButton(waitForObject(":Debugger Toolbar.Exit Debugger_QToolButton")) clickButton(waitForObject(":Debugger Toolbar.Exit Debugger_QToolButton"))
ensureChecked(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton") ensureChecked(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton")
output = waitForObject("{type='Core::OutputWindow' visible='1' windowTitle='Application Output Window'}", 20000) output = waitForObject("{type='Core::OutputWindow' visible='1' windowTitle='Application Output Window'}")
waitFor("'Debugging has finished' in str(output.plainText)", 20000) waitFor("'Debugging has finished' in str(output.plainText)", 20000)
return __logDebugResult__() return __logDebugResult__()

View File

@@ -31,7 +31,7 @@ def openQmakeProject(projectPath, targets = QtQuickConstants.Targets.DESKTOP_474
pass pass
__chooseTargets__(targets) __chooseTargets__(targets)
configureButton = waitForObject("{text='Configure Project' type='QPushButton' unnamed='1' visible='1'" configureButton = waitForObject("{text='Configure Project' type='QPushButton' unnamed='1' visible='1'"
"window=':Qt Creator_Core::Internal::MainWindow'}", 20000) "window=':Qt Creator_Core::Internal::MainWindow'}")
clickButton(configureButton) clickButton(configureButton)
def openCmakeProject(projectPath, buildDir): def openCmakeProject(projectPath, buildDir):
@@ -39,7 +39,7 @@ def openCmakeProject(projectPath, buildDir):
selectFromFileDialog(projectPath) selectFromFileDialog(projectPath)
replaceEditorContent("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'" replaceEditorContent("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'"
"window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'}", buildDir) "window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'}", buildDir)
clickButton(waitForObject(":CMake Wizard.Next_QPushButton", 20000)) clickButton(waitForObject(":CMake Wizard.Next_QPushButton"))
generatorCombo = waitForObject(":Generator:_QComboBox") generatorCombo = waitForObject(":Generator:_QComboBox")
mkspec = __getMkspecFromQmake__("qmake") mkspec = __getMkspecFromQmake__("qmake")
test.log("Using mkspec '%s'" % mkspec) test.log("Using mkspec '%s'" % mkspec)
@@ -56,7 +56,7 @@ def openCmakeProject(projectPath, buildDir):
else: else:
generatorCombo.setCurrentIndex(index) generatorCombo.setCurrentIndex(index)
clickButton(waitForObject(":CMake Wizard.Run CMake_QPushButton", 20000)) clickButton(waitForObject(":CMake Wizard.Run CMake_QPushButton"))
try: try:
clickButton(waitForObject(":CMake Wizard.Finish_QPushButton", 60000)) clickButton(waitForObject(":CMake Wizard.Finish_QPushButton", 60000))
except LookupError: except LookupError:
@@ -77,22 +77,22 @@ def __createProjectOrFileSelectType__(category, template, fromWelcome = False, i
mouseClick(waitForObject(":CreateProject_QStyleItem"), 5, 5, 0, Qt.LeftButton) mouseClick(waitForObject(":CreateProject_QStyleItem"), 5, 5, 0, Qt.LeftButton)
else: else:
invokeMenuItem("File", "New File or Project...") invokeMenuItem("File", "New File or Project...")
categoriesView = waitForObject("{type='QTreeView' name='templateCategoryView'}", 20000) categoriesView = waitForObject("{type='QTreeView' name='templateCategoryView'}")
if isProject: if isProject:
clickItem(categoriesView, "Projects." + category, 5, 5, 0, Qt.LeftButton) clickItem(categoriesView, "Projects." + category, 5, 5, 0, Qt.LeftButton)
else: else:
clickItem(categoriesView, "Files and Classes." + category, 5, 5, 0, Qt.LeftButton) clickItem(categoriesView, "Files and Classes." + category, 5, 5, 0, Qt.LeftButton)
templatesView = waitForObject("{name='templatesView' type='QListView'}", 20000) templatesView = waitForObject("{name='templatesView' type='QListView'}")
clickItem(templatesView, template, 5, 5, 0, Qt.LeftButton) clickItem(templatesView, template, 5, 5, 0, Qt.LeftButton)
text = waitForObject("{type='QTextBrowser' name='templateDescription' visible='1'}").plainText text = waitForObject("{type='QTextBrowser' name='templateDescription' visible='1'}").plainText
clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}", 20000)) clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}"))
return __getSupportedPlatforms__(str(text))[0] return __getSupportedPlatforms__(str(text))[0]
def __createProjectSetNameAndPath__(path, projectName = None, checks = True): def __createProjectSetNameAndPath__(path, projectName = None, checks = True):
directoryEdit = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000) directoryEdit = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}")
replaceEditorContent(directoryEdit, path) replaceEditorContent(directoryEdit, path)
projectNameEdit = waitForObject("{name='nameLineEdit' visible='1' " projectNameEdit = waitForObject("{name='nameLineEdit' visible='1' "
"type='Utils::ProjectNameValidatingLineEdit'}", 20000) "type='Utils::ProjectNameValidatingLineEdit'}")
if projectName == None: if projectName == None:
projectName = projectNameEdit.text projectName = projectNameEdit.text
else: else:
@@ -128,7 +128,7 @@ def __createProjectHandleLastPage__(expectedFiles = None):
test.verify(index > lastIndex, "'" + filename + "' found at index " + str(index)) test.verify(index > lastIndex, "'" + filename + "' found at index " + str(index))
lastIndex = index lastIndex = index
selectFromCombo(":addToVersionControlComboBox_QComboBox", "<None>") selectFromCombo(":addToVersionControlComboBox_QComboBox", "<None>")
clickButton(waitForObject("{type='QPushButton' text~='(Finish|Done)' visible='1'}", 20000)) clickButton(waitForObject("{type='QPushButton' text~='(Finish|Done)' visible='1'}"))
def __verifyFileCreation__(path, expectedFiles): def __verifyFileCreation__(path, expectedFiles):
for filename in expectedFiles: for filename in expectedFiles:
@@ -208,13 +208,13 @@ def createNewQtQuickApplication(workingDir, projectName = None, templateFile = N
% qtQuickVersion, fromWelcome) % qtQuickVersion, fromWelcome)
projectName = __createProjectSetNameAndPath__(workingDir, projectName) projectName = __createProjectSetNameAndPath__(workingDir, projectName)
if templateFile: if templateFile:
baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000) baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}")
type(baseLineEd, templateFile) type(baseLineEd, templateFile)
nextButton = waitForObject(":Next_QPushButton", 20000) nextButton = waitForObject(":Next_QPushButton")
clickButton(nextButton) clickButton(nextButton)
__chooseTargets__(targets, available) __chooseTargets__(targets, available)
snooze(1) snooze(1)
nextButton = waitForObject(":Next_QPushButton", 20000) nextButton = waitForObject(":Next_QPushButton")
clickButton(nextButton) clickButton(nextButton)
__createProjectHandleLastPage__() __createProjectHandleLastPage__()
return projectName return projectName
@@ -236,10 +236,10 @@ def createNewQmlExtension(workingDir):
nextButton = waitForObject(":Next_QPushButton") nextButton = waitForObject(":Next_QPushButton")
clickButton(nextButton) clickButton(nextButton)
nameLineEd = waitForObject("{buddy={type='QLabel' text='Object Class-name:' unnamed='1' visible='1'} " nameLineEd = waitForObject("{buddy={type='QLabel' text='Object Class-name:' unnamed='1' visible='1'} "
"type='QLineEdit' unnamed='1' visible='1'}", 20000) "type='QLineEdit' unnamed='1' visible='1'}")
replaceEditorContent(nameLineEd, "TestItem") replaceEditorContent(nameLineEd, "TestItem")
uriLineEd = waitForObject("{buddy={type='QLabel' text='URI:' unnamed='1' visible='1'} " uriLineEd = waitForObject("{buddy={type='QLabel' text='URI:' unnamed='1' visible='1'} "
"type='QLineEdit' unnamed='1' visible='1'}", 20000) "type='QLineEdit' unnamed='1' visible='1'}")
replaceEditorContent(uriLineEd, "org.qt-project.test.qmlcomponents") replaceEditorContent(uriLineEd, "org.qt-project.test.qmlcomponents")
clickButton(nextButton) clickButton(nextButton)
__createProjectHandleLastPage__() __createProjectHandleLastPage__()
@@ -247,7 +247,7 @@ def createNewQmlExtension(workingDir):
# parameter components can only be one of the Constants defined in QtQuickConstants.Components # parameter components can only be one of the Constants defined in QtQuickConstants.Components
def __chooseComponents__(components=QtQuickConstants.Components.BUILTIN): def __chooseComponents__(components=QtQuickConstants.Components.BUILTIN):
rbComponentToChoose = waitForObject("{type='QRadioButton' text='%s' visible='1'}" rbComponentToChoose = waitForObject("{type='QRadioButton' text='%s' visible='1'}"
% QtQuickConstants.getStringForComponents(components), 20000) % QtQuickConstants.getStringForComponents(components))
if rbComponentToChoose.checked: if rbComponentToChoose.checked:
test.passes("Selected QRadioButton is '%s'" % QtQuickConstants.getStringForComponents(components)) test.passes("Selected QRadioButton is '%s'" % QtQuickConstants.getStringForComponents(components))
else: else:
@@ -298,7 +298,7 @@ def runAndCloseApp(withHookInto=False, executable=None, port=None, function=None
overrideInstallLazySignalHandler() overrideInstallLazySignalHandler()
installLazySignalHandler("{type='ProjectExplorer::ApplicationLaucher'}", "processStarted()", "__handleProcessStarted__") installLazySignalHandler("{type='ProjectExplorer::ApplicationLaucher'}", "processStarted()", "__handleProcessStarted__")
installLazySignalHandler("{type='ProjectExplorer::ApplicationLaucher'}", "processExited(int)", "__handleProcessExited__") installLazySignalHandler("{type='ProjectExplorer::ApplicationLaucher'}", "processExited(int)", "__handleProcessExited__")
runButton = waitForObject("{type='Core::Internal::FancyToolButton' text='Run' visible='1'}", 20000) runButton = waitForObject("{type='Core::Internal::FancyToolButton' text='Run' visible='1'}")
clickButton(runButton) clickButton(runButton)
if sType != SubprocessType.QT_QUICK_UI: if sType != SubprocessType.QT_QUICK_UI:
waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)", 300000) waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)", 300000)
@@ -358,7 +358,7 @@ def __closeSubprocessByPushingStop__(sType):
def __closeSubprocessByHookingInto__(executable, port, function, sType, userDefType): def __closeSubprocessByHookingInto__(executable, port, function, sType, userDefType):
global processExited global processExited
ensureChecked(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton") ensureChecked(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton")
output = waitForObject("{type='Core::OutputWindow' visible='1' windowTitle='Application Output Window'}", 20000) output = waitForObject("{type='Core::OutputWindow' visible='1' windowTitle='Application Output Window'}")
if port == None: if port == None:
test.warning("I need a port number or attaching might fail.") test.warning("I need a port number or attaching might fail.")
else: else:

View File

@@ -41,7 +41,7 @@ def prepareBuildSettings(targetCount, currentTarget, setReleaseBuild=True, disab
else: else:
chooseThis = "Debug" chooseThis = "Debug"
editBuildCfg = waitForObject("{leftWidget={text='Edit build configuration:' type='QLabel' " editBuildCfg = waitForObject("{leftWidget={text='Edit build configuration:' type='QLabel' "
"unnamed='1' visible='1'} unnamed='1' type='QComboBox' visible='1'}", 20000) "unnamed='1' visible='1'} unnamed='1' type='QComboBox' visible='1'}")
selectFromCombo(editBuildCfg, chooseThis) selectFromCombo(editBuildCfg, chooseThis)
ensureChecked("{name='shadowBuildCheckBox' type='QCheckBox' visible='1'}", not disableShadowBuild) ensureChecked("{name='shadowBuildCheckBox' type='QCheckBox' visible='1'}", not disableShadowBuild)
# get back to the current target # get back to the current target

View File

@@ -18,7 +18,7 @@ def deleteDirIfExists(path):
shutil.rmtree(path, True) shutil.rmtree(path, True)
def verifyChecked(objectName): def verifyChecked(objectName):
object = waitForObject(objectName, 20000) object = waitForObject(objectName)
test.compare(object.checked, True) test.compare(object.checked, True)
return object return object
@@ -70,7 +70,7 @@ def selectFromLocator(filter, itemName = None):
if itemName == None: if itemName == None:
itemName = filter itemName = filter
itemName = itemName.replace(".", "\\.").replace("_", "\\_") itemName = itemName.replace(".", "\\.").replace("_", "\\_")
locator = waitForObject(":*Qt Creator_Utils::FilterLineEdit", 20000) locator = waitForObject(":*Qt Creator_Utils::FilterLineEdit")
mouseClick(locator, 5, 5, 0, Qt.LeftButton) mouseClick(locator, 5, 5, 0, Qt.LeftButton)
replaceEditorContent(locator, filter) replaceEditorContent(locator, filter)
# clicking the wanted item # clicking the wanted item
@@ -196,7 +196,7 @@ def logApplicationOutput():
# make sure application output is shown # make sure application output is shown
ensureChecked(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton") ensureChecked(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton")
try: try:
output = waitForObject("{type='Core::OutputWindow' visible='1' windowTitle='Application Output Window'}", 20000) output = waitForObject("{type='Core::OutputWindow' visible='1' windowTitle='Application Output Window'}")
test.log("Application Output:\n%s" % output.plainText) test.log("Application Output:\n%s" % output.plainText)
return str(output.plainText) return str(output.plainText)
except: except:

View File

@@ -31,7 +31,7 @@ def main():
# Rely on code completion for closing bracket # Rely on code completion for closing bracket
invokeMenuItem("File", "Save All") invokeMenuItem("File", "Save All")
selectFromLocator(project + ".pro") selectFromLocator(project + ".pro")
proEditor = waitForObject(":Qt Creator_ProFileEditorWidget", 20000) proEditor = waitForObject(":Qt Creator_ProFileEditorWidget")
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)
@@ -44,11 +44,11 @@ def main():
test.log("Running application") test.log("Running application")
runControlFinished = False runControlFinished = False
clickButton(waitForObject("{type='Core::Internal::FancyToolButton' text='Run' visible='1'}", 20000)) clickButton(waitForObject("{type='Core::Internal::FancyToolButton' text='Run' visible='1'}"))
waitFor("runControlFinished==True", 20000) waitFor("runControlFinished==True", 20000)
if not runControlFinished: if not runControlFinished:
test.warning("Waiting for runControlFinished timed out") test.warning("Waiting for runControlFinished timed out")
appOutput = str(waitForObject("{type='Core::OutputWindow' unnamed='1' visible='1'}", 20000).plainText) appOutput = str(waitForObject("{type='Core::OutputWindow' unnamed='1' visible='1'}").plainText)
verifyOutput(appOutput, outputStdOut, "std::cout", "Application Output") verifyOutput(appOutput, outputStdOut, "std::cout", "Application Output")
verifyOutput(appOutput, outputStdErr, "std::cerr", "Application Output") verifyOutput(appOutput, outputStdErr, "std::cerr", "Application Output")
verifyOutput(appOutput, outputQDebug, "qDebug()", "Application Output") verifyOutput(appOutput, outputQDebug, "qDebug()", "Application Output")
@@ -78,7 +78,7 @@ def main():
else: else:
test.fatal("Debugger log did not behave as expected. Please check manually.") test.fatal("Debugger log did not behave as expected. Please check manually.")
switchViewTo(ViewConstants.EDIT) switchViewTo(ViewConstants.EDIT)
appOutput = str(waitForObject("{type='Core::OutputWindow' unnamed='1' visible='1'}", 20000).plainText) appOutput = str(waitForObject("{type='Core::OutputWindow' unnamed='1' visible='1'}").plainText)
if not "MSVC" in config: if not "MSVC" in config:
verifyOutput(appOutput, outputStdOut, "std::cout", "Application Output") verifyOutput(appOutput, outputStdOut, "std::cout", "Application Output")
verifyOutput(appOutput, outputStdErr, "std::cerr", "Application Output") verifyOutput(appOutput, outputStdErr, "std::cerr", "Application Output")

View File

@@ -31,11 +31,11 @@ def testRenameId():
global searchFinished global searchFinished
test.log("Testing rename of id") test.log("Testing rename of id")
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'}")
model = navTree.model() model = navTree.model()
files = ["Core.ContextMenu\\.qml", "Core.GridMenu\\.qml", "Core.ListMenu\\.qml", "focus\\.qml"] files = ["Core.ContextMenu\\.qml", "Core.GridMenu\\.qml", "Core.ListMenu\\.qml", "focus\\.qml"]
originalTexts = {} originalTexts = {}
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000) editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
# temporarily store editor content for synchronizing purpose # temporarily store editor content for synchronizing purpose
# usage of formerTxt is done because I couldn't get waitForSignal() to work # usage of formerTxt is done because I couldn't get waitForSignal() to work
# it always stored a different object into the signalObjects map as it looked up afterwards # it always stored a different object into the signalObjects map as it looked up afterwards
@@ -45,7 +45,7 @@ def testRenameId():
doubleClickFile(navTree, file) doubleClickFile(navTree, file)
# wait until editor content switched to the double-clicked file # wait until editor content switched to the double-clicked file
while formerTxt==editor.plainText: while formerTxt==editor.plainText:
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000) editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
# store content for next round # store content for next round
formerTxt = editor.plainText formerTxt = editor.plainText
originalTexts.setdefault(file, "%s" % formerTxt) originalTexts.setdefault(file, "%s" % formerTxt)
@@ -71,7 +71,7 @@ def testRenameId():
doubleClickFile(navTree, file) doubleClickFile(navTree, file)
# wait until editor content switched to double-clicked file # wait until editor content switched to double-clicked file
while formerTxt==editor.plainText: while formerTxt==editor.plainText:
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000) editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
# store content for next round # store content for next round
formerTxt = editor.plainText formerTxt = editor.plainText
originalText = originalTexts.get(file).replace("mainView", "renamedView") originalText = originalTexts.get(file).replace("mainView", "renamedView")
@@ -81,7 +81,7 @@ def testRenameId():
def __invokeFindUsage__(treeView, filename, line, additionalKeyPresses, expectedCount): def __invokeFindUsage__(treeView, filename, line, additionalKeyPresses, expectedCount):
global searchFinished global searchFinished
doubleClickFile(treeView, filename) doubleClickFile(treeView, filename)
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000) editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
if not placeCursorToLine(editor, line, True): if not placeCursorToLine(editor, line, True):
test.fatal("File seems to have changed... Canceling current test") test.fatal("File seems to have changed... Canceling current test")
return return
@@ -95,7 +95,7 @@ def __invokeFindUsage__(treeView, filename, line, additionalKeyPresses, expected
def testFindUsages(): def testFindUsages():
test.log("Testing find usage of an ID") test.log("Testing find usage of an ID")
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'}")
__invokeFindUsage__(navTree, "focus\\.qml", "FocusScope\s*\{", ["<Down>"], 6) __invokeFindUsage__(navTree, "focus\\.qml", "FocusScope\s*\{", ["<Down>"], 6)
test.log("Testing find usage of a property") test.log("Testing find usage of a property")
clickButton(waitForObject(":*Qt Creator.Clear_QToolButton")) clickButton(waitForObject(":*Qt Creator.Clear_QToolButton"))
@@ -106,10 +106,10 @@ def testFindUsages():
def testHovering(): def testHovering():
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'}")
test.log("Testing hovering elements") test.log("Testing hovering elements")
doubleClickFile(navTree, "focus\\.qml") doubleClickFile(navTree, "focus\\.qml")
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000) editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
lines=["FocusScope\s*\{", "Rectangle\s*\{"] lines=["FocusScope\s*\{", "Rectangle\s*\{"]
if platform.system() == "Darwin": if platform.system() == "Darwin":
home = "<Ctrl+Left>" home = "<Ctrl+Left>"
@@ -127,7 +127,7 @@ def testHovering():
verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues) verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues)
test.log("Testing hovering properties") test.log("Testing hovering properties")
doubleClickFile(navTree, "focus\\.qml") doubleClickFile(navTree, "focus\\.qml")
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000) editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
lines = ['focus:\s*true', 'color:\s*"black"', 'states:\s*State\s*\{', 'transitions:\s*Transition\s*\{'] lines = ['focus:\s*true', 'color:\s*"black"', 'states:\s*State\s*\{', 'transitions:\s*Transition\s*\{']
expectedTypes = ["TextTip", "TextTip", "TextTip", "TextTip"] expectedTypes = ["TextTip", "TextTip", "TextTip", "TextTip"]
expectedValues = [ expectedValues = [
@@ -147,14 +147,14 @@ def testHovering():
verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues) verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues)
test.log("Testing hovering expressions") test.log("Testing hovering expressions")
doubleClickFile(navTree, "focus\\.qml") doubleClickFile(navTree, "focus\\.qml")
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000) editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
lines=['color:\s*"black"', 'color:\s*"#3E606F"'] lines=['color:\s*"black"', 'color:\s*"#3E606F"']
additionalKeyPresses = ["<Left>"] additionalKeyPresses = ["<Left>"]
expectedValues = ["black", "#3E606F"] expectedValues = ["black", "#3E606F"]
expectedTypes = ["ColorTip", "ColorTip"] expectedTypes = ["ColorTip", "ColorTip"]
verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues) verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues)
doubleClickFile(navTree, "Core.ListMenu\\.qml") doubleClickFile(navTree, "Core.ListMenu\\.qml")
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000) editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
lines=['Rectangle\s*\{.*color:\s*"#D1DBBD"', 'NumberAnimation\s*\{\s*.*Easing.OutQuint\s*\}'] lines=['Rectangle\s*\{.*color:\s*"#D1DBBD"', 'NumberAnimation\s*\{\s*.*Easing.OutQuint\s*\}']
additionalKeyPresses = ["<Left>", "<Left>", "<Left>", "<Left>"] additionalKeyPresses = ["<Left>", "<Left>", "<Left>", "<Left>"]
expectedTypes = ["ColorTip", "TextTip"] expectedTypes = ["ColorTip", "TextTip"]

View File

@@ -19,11 +19,11 @@ def main():
def prepareQmlFile(): def prepareQmlFile():
# make sure the QML file is opened # make sure the QML file is opened
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'}")
model = navTree.model() model = navTree.model()
waitForObjectItem(navTree, "untitled.QML.qml/untitled.main\\.qml") waitForObjectItem(navTree, "untitled.QML.qml/untitled.main\\.qml")
doubleClickItem(navTree, "untitled.QML.qml/untitled.main\\.qml", 5, 5, 0, Qt.LeftButton) doubleClickItem(navTree, "untitled.QML.qml/untitled.main\\.qml", 5, 5, 0, Qt.LeftButton)
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000) editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
for i in range(3): for i in range(3):
content = "%s" % editor.plainText content = "%s" % editor.plainText
start = content.find("Text {") start = content.find("Text {")

View File

@@ -17,7 +17,7 @@ def main():
test.log("Collecting potential project types...") test.log("Collecting potential project types...")
availableProjectTypes = [] availableProjectTypes = []
invokeMenuItem("File", "New File or Project...") invokeMenuItem("File", "New File or Project...")
categoriesView = waitForObject(":New.templateCategoryView_QTreeView", 20000) categoriesView = waitForObject(":New.templateCategoryView_QTreeView")
catModel = categoriesView.model() catModel = categoriesView.model()
projects = catModel.index(0, 0) projects = catModel.index(0, 0)
test.compare("Projects", str(projects.data())) test.compare("Projects", str(projects.data()))
@@ -29,7 +29,7 @@ def main():
if "Import" in category or "Non-Qt" in category: if "Import" in category or "Non-Qt" in category:
continue continue
clickItem(categoriesView, "Projects." + category, 5, 5, 0, Qt.LeftButton) clickItem(categoriesView, "Projects." + category, 5, 5, 0, Qt.LeftButton)
templatesView = waitForObject("{name='templatesView' type='QListView' visible='1'}", 20000) templatesView = waitForObject("{name='templatesView' type='QListView' visible='1'}")
# needed because categoriesView and templatesView using same model # needed because categoriesView and templatesView using same model
for template in dumpItems(templatesView.model(), templatesView.rootIndex()): for template in dumpItems(templatesView.model(), templatesView.rootIndex()):
template = template.replace(".", "\\.") template = template.replace(".", "\\.")
@@ -37,21 +37,21 @@ def main():
if "Qt Quick UI" in template or "Plain C" in template: if "Qt Quick UI" in template or "Plain C" in template:
continue continue
availableProjectTypes.append({category:template}) availableProjectTypes.append({category:template})
clickButton(waitForObject("{text='Cancel' type='QPushButton' unnamed='1' visible='1'}", 20000)) clickButton(waitForObject("{text='Cancel' type='QPushButton' unnamed='1' visible='1'}"))
for current in availableProjectTypes: for current in availableProjectTypes:
category = current.keys()[0] category = current.keys()[0]
template = current.values()[0] template = current.values()[0]
invokeMenuItem("File", "New File or Project...") invokeMenuItem("File", "New File or Project...")
categoriesView = waitForObject(":New.templateCategoryView_QTreeView", 20000) categoriesView = waitForObject(":New.templateCategoryView_QTreeView")
clickItem(categoriesView, "Projects." + category, 5, 5, 0, Qt.LeftButton) clickItem(categoriesView, "Projects." + category, 5, 5, 0, Qt.LeftButton)
templatesView = waitForObject("{name='templatesView' type='QListView' visible='1'}", 20000) templatesView = waitForObject("{name='templatesView' type='QListView' visible='1'}")
test.log("Verifying '%s' -> '%s'" % (category.replace("\\.", "."), template.replace("\\.", "."))) test.log("Verifying '%s' -> '%s'" % (category.replace("\\.", "."), template.replace("\\.", ".")))
textChanged = False textChanged = False
clickItem(templatesView, template, 5, 5, 0, Qt.LeftButton) clickItem(templatesView, template, 5, 5, 0, Qt.LeftButton)
waitFor("textChanged", 2000) waitFor("textChanged", 2000)
text = waitForObject(":frame.templateDescription_QTextBrowser").plainText text = waitForObject(":frame.templateDescription_QTextBrowser").plainText
displayedPlatforms, requiredVersion = __getSupportedPlatforms__(str(text), True) displayedPlatforms, requiredVersion = __getSupportedPlatforms__(str(text), True)
clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}", 20000)) clickButton(waitForObject("{text='Choose...' type='QPushButton' unnamed='1' visible='1'}"))
# don't check because project could exist # don't check because project could exist
__createProjectSetNameAndPath__(os.path.expanduser("~"), 'untitled', False) __createProjectSetNameAndPath__(os.path.expanduser("~"), 'untitled', False)
try: try:
@@ -60,7 +60,7 @@ def main():
except LookupError: except LookupError:
try: try:
waitForObject("{text='Select Existing QML file' type='QLabel' visible='1'}", 1000) waitForObject("{text='Select Existing QML file' type='QLabel' visible='1'}", 1000)
baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000) baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}")
type(baseLineEd, os.path.join(templateDir, qmlFile)) type(baseLineEd, os.path.join(templateDir, qmlFile))
clickButton(waitForObject(":Next_QPushButton")) clickButton(waitForObject(":Next_QPushButton"))
except LookupError: except LookupError: