forked from qt-creator/qt-creator
Squish: Introduce new helper function
Change-Id: I6ef3022e7053c1e4993cc4276ccd2502de196754 Reviewed-by: Robert Löhning <robert.loehning@nokia.com>
This commit is contained in:
committed by
Robert Löhning
parent
f3bbbaeef6
commit
f3fd47f601
@@ -225,3 +225,37 @@ def verifyProperties(properties, expectedProps):
|
|||||||
else:
|
else:
|
||||||
result[key] = None
|
result[key] = None
|
||||||
return result
|
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'}")
|
||||||
|
else:
|
||||||
|
test.log("Trying PlainTextEditor (file suffix: %s)" % suffix)
|
||||||
|
try:
|
||||||
|
editor = waitForObject("{type='TextEditor::PlainTextEditorWidget' unnamed='1' "
|
||||||
|
"visible='1' window=':Qt Creator_Core::Internal::MainWindow'}", 3000)
|
||||||
|
except:
|
||||||
|
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
|
||||||
|
else:
|
||||||
|
return suffix[1]
|
||||||
|
@@ -10,21 +10,23 @@ def charactersInFile(filename):
|
|||||||
return len(content)
|
return len(content)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
filesAndEditors = {srcPath + "/creator/README" : "TextEditor::PlainTextEditorWidget",
|
files = [srcPath + "/creator/README", srcPath + "/creator/qtcreator.pri",
|
||||||
srcPath + "/creator/qtcreator.pri" : "Qt4ProjectManager::Internal::ProFileEditorWidget",
|
srcPath + "/creator/doc/snippets/qml/list-of-transitions.qml"]
|
||||||
srcPath + "/creator/doc/snippets/qml/list-of-transitions.qml" : "QmlJSEditor::QmlJSTextEditorWidget"}
|
for currentFile in files:
|
||||||
for currentFile in filesAndEditors:
|
|
||||||
if not neededFilePresent(currentFile):
|
if not neededFilePresent(currentFile):
|
||||||
return
|
return
|
||||||
|
|
||||||
startApplication("qtcreator" + SettingsPath)
|
startApplication("qtcreator" + SettingsPath)
|
||||||
for currentFile in filesAndEditors:
|
for currentFile in files:
|
||||||
test.log("Opening file %s" % currentFile)
|
test.log("Opening file %s" % currentFile)
|
||||||
size = charactersInFile(currentFile)
|
size = charactersInFile(currentFile)
|
||||||
invokeMenuItem("File", "Open File or Project...")
|
invokeMenuItem("File", "Open File or Project...")
|
||||||
selectFromFileDialog(currentFile)
|
selectFromFileDialog(currentFile)
|
||||||
editor = waitForObject("{type='%s' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}"
|
editor = getEditorForFileSuffix(currentFile)
|
||||||
% filesAndEditors[currentFile], 20000)
|
if editor == None:
|
||||||
|
test.fatal("Could not get the editor for '%s'" % currentFile,
|
||||||
|
"Skipping this file for now.")
|
||||||
|
continue
|
||||||
JIRA.performWorkaroundIfStillOpen(6918, JIRA.Bug.CREATOR, editor)
|
JIRA.performWorkaroundIfStillOpen(6918, JIRA.Bug.CREATOR, editor)
|
||||||
for key in ["<Up>", "<Down>", "<Left>", "<Right>"]:
|
for key in ["<Up>", "<Down>", "<Left>", "<Right>"]:
|
||||||
test.log("Selecting everything")
|
test.log("Selecting everything")
|
||||||
|
Reference in New Issue
Block a user