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