Commit f3fd47f6 authored by Christian Stenger's avatar Christian Stenger Committed by Robert Löhning
Browse files

Squish: Introduce new helper function

Change-Id: I6ef3022e7053c1e4993cc4276ccd2502de196754
Reviewed-by: default avatarRobert Löhning <>
parent f3bbbaee
......@@ -225,3 +225,37 @@ def verifyProperties(properties, expectedProps):
result[key] = None
return result
def getEditorForFileSuffix(curFile):
cppEditorSuffixes = ["cpp", "cc", "CC", "h", "H", "cp", "cxx", "C", "c++", "inl", "moc", "qdoc",
"tcc", "tpp", "t++", "c", "cu", "m", "mm", "hh", "hxx", "h++", "hpp", "hp"]
qmlEditorSuffixes = ["qml", "qmlproject", "js", "qs", "qtt"]
proEditorSuffixes = ["pro", "pri", "prf"]
suffix = __getFileSuffix__(curFile)
if suffix in cppEditorSuffixes:
editor = waitForObject("{type='CppEditor::Internal::CPPEditorWidget' unnamed='1' "
"visible='1' window=':Qt Creator_Core::Internal::MainWindow'}")
elif suffix in qmlEditorSuffixes:
editor = waitForObject("{type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' "
"visible='1' window=':Qt Creator_Core::Internal::MainWindow'}")
elif suffix in proEditorSuffixes:
editor = waitForObject("{type='Qt4ProjectManager::Internal::ProFileEditorWidget' unnamed='1' "
"visible='1' window=':Qt Creator_Core::Internal::MainWindow'}")
test.log("Trying PlainTextEditor (file suffix: %s)" % suffix)
editor = waitForObject("{type='TextEditor::PlainTextEditorWidget' unnamed='1' "
"visible='1' window=':Qt Creator_Core::Internal::MainWindow'}", 3000)
test.fatal("Unsupported file suffix for file '%s'" % curFile)
editor = None
return editor
# helper that determines the file suffix of the given fileName
# (doesn't matter if fileName contains the path as well)
def __getFileSuffix__(fileName):
suffix = os.path.basename(fileName).rsplit(".", 1)
if len(suffix) == 1:
return None
return suffix[1]
......@@ -10,21 +10,23 @@ def charactersInFile(filename):
return len(content)
def main():
filesAndEditors = {srcPath + "/creator/README" : "TextEditor::PlainTextEditorWidget",
srcPath + "/creator/qtcreator.pri" : "Qt4ProjectManager::Internal::ProFileEditorWidget",
srcPath + "/creator/doc/snippets/qml/list-of-transitions.qml" : "QmlJSEditor::QmlJSTextEditorWidget"}
for currentFile in filesAndEditors:
files = [srcPath + "/creator/README", srcPath + "/creator/qtcreator.pri",
srcPath + "/creator/doc/snippets/qml/list-of-transitions.qml"]
for currentFile in files:
if not neededFilePresent(currentFile):
startApplication("qtcreator" + SettingsPath)
for currentFile in filesAndEditors:
for currentFile in files:
test.log("Opening file %s" % currentFile)
size = charactersInFile(currentFile)
invokeMenuItem("File", "Open File or Project...")
editor = waitForObject("{type='%s' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}"
% filesAndEditors[currentFile], 20000)
editor = getEditorForFileSuffix(currentFile)
if editor == None:
test.fatal("Could not get the editor for '%s'" % currentFile,
"Skipping this file for now.")
JIRA.performWorkaroundIfStillOpen(6918, JIRA.Bug.CREATOR, editor)
for key in ["<Up>", "<Down>", "<Left>", "<Right>"]:
test.log("Selecting everything")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment