Squish: Verify project was found when adding file

Change-Id: I313d1ba1b621d45620bf613760cefdf0a2d2341c
Task-number: QTCREATORBUG-17994
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Robert Loehning
2017-05-10 14:56:00 +02:00
parent 9b44c6ea4f
commit d7f79349ed
5 changed files with 25 additions and 15 deletions

View File

@@ -212,6 +212,7 @@
:popupFrame_Proposal_QListView {container=':popupFrame_TextEditor::GenericProposalWidget' type='QListView' unnamed='1' visible='1'} :popupFrame_Proposal_QListView {container=':popupFrame_TextEditor::GenericProposalWidget' type='QListView' unnamed='1' visible='1'}
:popupFrame_TextEditor::GenericProposalWidget {name='m_popupFrame' type='TextEditor::GenericProposalWidget' visible='1'} :popupFrame_TextEditor::GenericProposalWidget {name='m_popupFrame' type='TextEditor::GenericProposalWidget' visible='1'}
:projectComboBox_QComboBox {buddy=':New Text File.Add to project:_QLabel' name='projectComboBox' type='QComboBox' visible='1'} :projectComboBox_QComboBox {buddy=':New Text File.Add to project:_QLabel' name='projectComboBox' type='QComboBox' visible='1'}
:projectComboBox_Utils::TreeViewComboBox {buddy=':New Text File.Add to project:_QLabel' name='projectComboBox' type='Utils::TreeViewComboBox' visible='1'}
:qdesigner_internal::WidgetBoxCategoryListView {container=':Widget Box_qdesigner_internal::WidgetBoxTreeWidget' occurrence='3' type='qdesigner_internal::WidgetBoxCategoryListView' unnamed='1' visible='1'} :qdesigner_internal::WidgetBoxCategoryListView {container=':Widget Box_qdesigner_internal::WidgetBoxTreeWidget' occurrence='3' type='qdesigner_internal::WidgetBoxCategoryListView' unnamed='1' visible='1'}
:qmakeCallEdit {container=':Qt Creator.scrollArea_QScrollArea' text?='<b>qmake:</b> qmake*' type='QLabel' unnamed='1' visible='1'} :qmakeCallEdit {container=':Qt Creator.scrollArea_QScrollArea' text?='<b>qmake:</b> qmake*' type='QLabel' unnamed='1' visible='1'}
:qt_tabwidget_stackedwidget.Core__Internal__GeneralSettings_QWidget {container=':Options.qt_tabwidget_stackedwidget_QStackedWidget' name='Core__Internal__GeneralSettings' type='QWidget' visible='1'} :qt_tabwidget_stackedwidget.Core__Internal__GeneralSettings_QWidget {container=':Options.qt_tabwidget_stackedwidget_QStackedWidget' name='Core__Internal__GeneralSettings' type='QWidget' visible='1'}

View File

@@ -749,13 +749,14 @@ def compareProjectTree(rootObject, dataset):
# creates C++ file(s) and adds them to the current project if one is open # creates C++ file(s) and adds them to the current project if one is open
# name name of the created object: filename for files, classname for classes # name name of the created object: filename for files, classname for classes
# template "C++ Class", "C++ Header File" or "C++ Source File" # template "C++ Class", "C++ Header File" or "C++ Source File"
# projectName None or name of open project that the files will be added to
# forceOverwrite bool: force overwriting existing files? # forceOverwrite bool: force overwriting existing files?
# addToVCS name of VCS to add the file(s) to # addToVCS name of VCS to add the file(s) to
# newBasePath path to create the file(s) at # newBasePath path to create the file(s) at
# expectedSourceName expected name of created source file # expectedSourceName expected name of created source file
# expectedHeaderName expected name of created header file # expectedHeaderName expected name of created header file
def addCPlusPlusFileToCurrentProject(name, template, forceOverwrite=False, addToVCS="<None>", def addCPlusPlusFile(name, template, projectName, forceOverwrite=False, addToVCS="<None>",
newBasePath=None, expectedSourceName=None, expectedHeaderName=None): newBasePath=None, expectedSourceName=None, expectedHeaderName=None):
if name == None: if name == None:
test.fatal("File must have a name - got None.") test.fatal("File must have a name - got None.")
return return
@@ -785,6 +786,14 @@ def addCPlusPlusFileToCurrentProject(name, template, forceOverwrite=False, addTo
test.compare(str(waitForObject("{name='HdrFileName' type='QLineEdit' visible='1'}").text), test.compare(str(waitForObject("{name='HdrFileName' type='QLineEdit' visible='1'}").text),
expectedHeaderName) expectedHeaderName)
clickButton(waitForObject(":Next_QPushButton")) clickButton(waitForObject(":Next_QPushButton"))
projectComboBox = waitForObjectExists(":projectComboBox_Utils::TreeViewComboBox")
test.compare(projectComboBox.enabled, projectName != None,
"Project combo box must be enabled when a project is open")
projectNameToDisplay = "<None>"
if projectName:
projectNameToDisplay = projectName
test.compare(str(projectComboBox.currentText), projectNameToDisplay,
"The right project must be selected")
fileExistedBefore = False fileExistedBefore = False
if template == "C++ Class": if template == "C++ Class":
fileExistedBefore = (os.path.exists(os.path.join(basePath, name.lower() + ".cpp")) fileExistedBefore = (os.path.exists(os.path.join(basePath, name.lower() + ".cpp"))

View File

@@ -42,8 +42,8 @@ def main():
if not testRenameMacroAfterSourceModification(): if not testRenameMacroAfterSourceModification():
return return
headerName = "anothertestfile.h" headerName = "anothertestfile.h"
addCPlusPlusFileToCurrentProject(headerName, "C++ Header File", addCPlusPlusFile(headerName, "C++ Header File", "testfiles.pro",
expectedHeaderName=headerName) expectedHeaderName=headerName)
if not testRenameMacroAfterSourceMoving(): if not testRenameMacroAfterSourceMoving():
return return
invokeMenuItem("File", "Save All") invokeMenuItem("File", "Save All")

View File

@@ -34,9 +34,9 @@ def main():
startApplication("qtcreator" + SettingsPath) startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
addCPlusPlusFileToCurrentProject(newClassName, "C++ Class", newBasePath=basePath, addCPlusPlusFile(newClassName, "C++ Class", None, newBasePath=basePath,
expectedSourceName=sourceFileName, expectedSourceName=sourceFileName,
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("sourceFileName in str(mainWindow.windowTitle)", 1000),
@@ -77,17 +77,17 @@ def main():
def overwritten(filename): def overwritten(filename):
return notOverwrittenComment not in readFile(os.path.join(basePath, filename)) return notOverwrittenComment not in readFile(os.path.join(basePath, filename))
addCPlusPlusFileToCurrentProject(newClassName, "C++ Class", False, newBasePath=basePath, addCPlusPlusFile(newClassName, "C++ Class", None, False,
expectedSourceName=sourceFileName, newBasePath=basePath, expectedSourceName=sourceFileName,
expectedHeaderName=headerFileName) expectedHeaderName=headerFileName)
test.verify(not waitFor("overwritten(sourceFileName)", 2000), test.verify(not waitFor("overwritten(sourceFileName)", 2000),
"Source file should not be overwritten.") "Source file should not be overwritten.")
test.verify(not waitFor("overwritten(headerFileName)", 500), test.verify(not waitFor("overwritten(headerFileName)", 500),
"Header file should not be overwritten.") "Header file should not be overwritten.")
addCPlusPlusFileToCurrentProject(newClassName, "C++ Class", True, newBasePath=basePath, addCPlusPlusFile(newClassName, "C++ Class", None, True,
expectedSourceName=sourceFileName, newBasePath=basePath, expectedSourceName=sourceFileName,
expectedHeaderName=headerFileName) expectedHeaderName=headerFileName)
test.verify(waitFor("overwritten(sourceFileName)", 2000), test.verify(waitFor("overwritten(sourceFileName)", 2000),
"Source file should be overwritten.") "Source file should be overwritten.")
test.verify(waitFor("overwritten(headerFileName)", 500), test.verify(waitFor("overwritten(headerFileName)", 500),

View File

@@ -175,8 +175,8 @@ def main():
commitMessages = [commit("Initial Commit", "Committed 5 file(s).")] commitMessages = [commit("Initial Commit", "Committed 5 file(s).")]
clickButton(waitForObject(":*Qt Creator.Clear_QToolButton")) clickButton(waitForObject(":*Qt Creator.Clear_QToolButton"))
headerName = "pointless_header.h" headerName = "pointless_header.h"
addCPlusPlusFileToCurrentProject(headerName, "C++ Header File", addToVCS="Git", addCPlusPlusFile(headerName, "C++ Header File", projectName + ".pro",
expectedHeaderName=headerName) addToVCS="Git", expectedHeaderName=headerName)
commitMessages.insert(0, commit("Added pointless header file", "Committed 2 file(s).")) commitMessages.insert(0, commit("Added pointless header file", "Committed 2 file(s)."))
readmeName = "README.txt" readmeName = "README.txt"
addEmptyFileOutsideProject(readmeName) addEmptyFileOutsideProject(readmeName)