summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@digia.com>2014-06-04 09:44:20 +0200
committerChristian Stenger <christian.stenger@digia.com>2014-06-04 15:12:50 +0200
commit7a86928fbc4f379841fbff5081de3ea5c76ac436 (patch)
tree7e15e57b00023f1206e52045f52a02de846ecdc7
parentdcc3dcadacbd115002593aaa452c3ba0ba9b37d9 (diff)
downloadqt-creator-7a86928fbc4f379841fbff5081de3ea5c76ac436.tar.gz
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>
-rw-r--r--tests/system/shared/debugger.py2
-rw-r--r--tests/system/shared/editor_utils.py9
-rw-r--r--tests/system/shared/utils.py7
-rw-r--r--tests/system/suite_general/tst_save_before_build/test.py2
4 files changed, 14 insertions, 6 deletions
diff --git a/tests/system/shared/debugger.py b/tests/system/shared/debugger.py
index 754ce55fc1..069a390db1 100644
--- a/tests/system/shared/debugger.py
+++ b/tests/system/shared/debugger.py
@@ -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")
diff --git a/tests/system/shared/editor_utils.py b/tests/system/shared/editor_utils.py
index f296b9942b..d29465d2df 100644
--- a/tests/system/shared/editor_utils.py
+++ b/tests/system/shared/editor_utils.py
@@ -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")
diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py
index 03efc084cb..2710aae948 100644
--- a/tests/system/shared/utils.py
+++ b/tests/system/shared/utils.py
@@ -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):
diff --git a/tests/system/suite_general/tst_save_before_build/test.py b/tests/system/suite_general/tst_save_before_build/test.py
index 71c7839017..91862f590e 100644
--- a/tests/system/suite_general/tst_save_before_build/test.py
+++ b/tests/system/suite_general/tst_save_before_build/test.py
@@ -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: