Commit ba1036fd authored by Robert Loehning's avatar Robert Loehning

Squish: Fix searching for filename in windowTitle

Currently, only the end of a filename as actually
compared since the title also contains "filename.h"
when the title starts with "otherfilename.h"

Change-Id: I60dd4dc1fd7c53fee2ddbc44953bcfe4d75c7530
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent 69b75895
......@@ -246,7 +246,7 @@ def verifyBreakPoint(bpToVerify):
textPos = editor.textCursor().position()
line = str(editor.plainText)[:textPos].count("\n") + 1
windowTitle = str(waitForObject(":Qt Creator_Core::Internal::MainWindow").windowTitle)
test.verify(os.path.basename(fileName) in windowTitle,
test.verify(windowTitle.startswith(os.path.basename(fileName) + " "),
"Verify that Creator's window title changed according to current file")
return test.compare(line, bpToVerify.values()[0],
"Compare hit breakpoint to expected line number in %s" % fileName)
......
......@@ -267,7 +267,7 @@ def getEditorForFileSuffix(curFile, treeViewSyntax=False):
if treeViewSyntax:
expected = simpleFileName(curFile)
mainWindow = waitForObject(":Qt Creator_Core::Internal::MainWindow")
if not waitFor("expected in str(mainWindow.windowTitle)", 5000):
if not waitFor("str(mainWindow.windowTitle).startswith(expected + ' ')", 5000):
test.fatal("Window title (%s) did not switch to expected file (%s)."
% (str(mainWindow.windowTitle), expected))
try:
......@@ -387,7 +387,7 @@ def openDocument(treeElement):
doubleClickItem(navigator, treeElement, 5, 5, 0, Qt.LeftButton)
mainWindow = waitForObject(":Qt Creator_Core::Internal::MainWindow")
expected = str(item.text).split("/")[-1]
if waitFor("expected in str(mainWindow.windowTitle)", 5000):
if waitFor("str(mainWindow.windowTitle).startswith(expected + ' ')", 5000):
return True
test.log("Expected file (%s) was not being opened in openDocument()" % expected)
return False
......
......@@ -82,7 +82,7 @@ def main():
# Creator should show the declaration of the function again.
selectFromLocator("dummy.cpp")
mainWin = findObject(":Qt Creator_Core::Internal::MainWindow")
if not waitFor("'dummy.cpp ' in str(mainWin.windowTitle) and ' @ cplusplus-tools ' in str(mainWin.windowTitle)", 5000):
if not waitFor("str(mainWin.windowTitle).startswith('dummy.cpp ') and ' @ cplusplus-tools ' in str(mainWin.windowTitle)", 5000):
test.warning("Opening dummy.cpp seems to have failed")
# Reset cursor to the start of the document
if platform.system() == 'Darwin':
......
......@@ -39,7 +39,7 @@ def main():
expectedHeaderName=headerFileName)
mainWindow = waitForObject(":Qt Creator_Core::Internal::MainWindow")
if test.verify(waitFor("sourceFileName in str(mainWindow.windowTitle)", 1000),
if test.verify(waitFor("str(mainWindow.windowTitle).startswith(sourceFileName + ' ')", 1000),
"Source file was opened on time?"):
editor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
editorText = str(editor.plainText)
......@@ -52,7 +52,7 @@ def main():
type(editor, "<Return>")
invokeMenuItem("File", "Save All")
clickButton(waitForObject(":Qt Creator.CloseDoc_QToolButton"))
if test.verify(waitFor("headerFileName in str(mainWindow.windowTitle)", 2000),
if test.verify(waitFor("str(mainWindow.windowTitle).startswith(headerFileName + ' ')", 2000),
"Header file was shown after closing source?"):
editor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
editorText = str(editor.plainText)
......
......@@ -58,7 +58,7 @@ def main():
"Verifying window title contains created session name.")
checkNavigator(52, "Verifying whether all projects have been re-opened.")
checkOpenDocuments(2, "Verifying whether 2 files have been re-opened.")
if test.verify("main.cpp" in str(mainWindow.windowTitle),
if test.verify(str(mainWindow.windowTitle).startswith("main.cpp "),
"Verifying whether utility.h has been opened."):
current = str(waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget").plainText)
test.verify(originalText == current, "Verifying that same file has been opened.")
......
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