forked from qt-creator/qt-creator
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:
@@ -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")
|
||||
|
@@ -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")
|
||||
|
@@ -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):
|
||||
|
@@ -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:
|
||||
|
Reference in New Issue
Block a user