Squish: Fix getEditorForFileSuffix() and simpleFileName()...

...when using filenames coming from Squish's treeview syntax.

Change-Id: I0296dbabb09af11dde5ed4716b1b1f48f05c47e1
Reviewed-by: Robert Loehning <robert.loehning@digia.com>
This commit is contained in:
Christian Stenger
2014-06-04 09:44:20 +02:00
parent dcc3dcadac
commit 7a86928fbc
4 changed files with 14 additions and 6 deletions

View File

@@ -81,7 +81,7 @@ def setBreakpointsForCurrentProject(filesAndLines):
for curFile,curLine in current.iteritems():
if not openDocument(curFile):
return False
editor = getEditorForFileSuffix(curFile)
editor = getEditorForFileSuffix(curFile, True)
if not placeCursorToLine(editor, curLine, True):
return False
invokeMenuItem("Debug", "Toggle Breakpoint")

View File

@@ -255,7 +255,7 @@ def verifyProperties(properties, expectedProps):
result[key] = None
return result
def getEditorForFileSuffix(curFile):
def getEditorForFileSuffix(curFile, treeViewSyntax=False):
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"]
@@ -263,10 +263,13 @@ def getEditorForFileSuffix(curFile):
glslEditorSuffixes= ["frag", "vert", "fsh", "vsh", "glsl", "shader", "gsh"]
pytEditorSuffixes = ["py", "pyw", "wsgi"]
suffix = __getFileSuffix__(curFile)
expected = os.path.basename(curFile)
if treeViewSyntax:
expected = simpleFileName(curFile)
mainWindow = waitForObject(":Qt Creator_Core::Internal::MainWindow")
if not waitFor("os.path.basename(curFile) in str(mainWindow.windowTitle)", 5000):
if not waitFor("expected in str(mainWindow.windowTitle)", 5000):
test.fatal("Window title (%s) did not switch to expected file (%s)."
% (str(mainWindow.windowTitle), os.path.basename(curFile)))
% (str(mainWindow.windowTitle), expected))
try:
if suffix in cppEditorSuffixes:
editor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")

View File

@@ -603,7 +603,12 @@ def readFile(filename):
return content
def simpleFileName(navigatorFileName):
return ".".join(navigatorFileName.split(".")[-2:]).replace("\\","")
# try to find the last part of the given name, assume it's inside a (folder) structure
search = re.search(".*[^\\\\]\.(.*)$", navigatorFileName)
if search:
return search.group(1).replace("\\", "")
# it's just the filename
return navigatorFileName.replace("\\", "")
def clickOnTab(tabBarStr, tabText, timeout=5000):
if not waitFor("object.exists(tabBarStr)", timeout):

View File

@@ -58,7 +58,7 @@ def main():
test.fatal("Could not open file '%s'" % simpleFileName(file))
continue
test.log("Changing file '%s'" % simpleFileName(file))
typeLines(getEditorForFileSuffix(file), "")
typeLines(getEditorForFileSuffix(file, True), "")
# try to compile
clickButton(waitForObject(":*Qt Creator.Build Project_Core::Internal::FancyToolButton"))
try: