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_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_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'}
: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'}

View File

@@ -749,12 +749,13 @@ def compareProjectTree(rootObject, dataset):
# 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
# 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?
# addToVCS name of VCS to add the file(s) to
# newBasePath path to create the file(s) at
# expectedSourceName expected name of created source 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):
if name == None:
test.fatal("File must have a name - got None.")
@@ -785,6 +786,14 @@ def addCPlusPlusFileToCurrentProject(name, template, forceOverwrite=False, addTo
test.compare(str(waitForObject("{name='HdrFileName' type='QLineEdit' visible='1'}").text),
expectedHeaderName)
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
if template == "C++ Class":
fileExistedBefore = (os.path.exists(os.path.join(basePath, name.lower() + ".cpp"))

View File

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

View File

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

View File

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