forked from qt-creator/qt-creator
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:
@@ -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'}
|
||||
|
@@ -749,13 +749,14 @@ 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>",
|
||||
newBasePath=None, expectedSourceName=None, expectedHeaderName=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.")
|
||||
return
|
||||
@@ -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"))
|
||||
|
@@ -42,8 +42,8 @@ def main():
|
||||
if not testRenameMacroAfterSourceModification():
|
||||
return
|
||||
headerName = "anothertestfile.h"
|
||||
addCPlusPlusFileToCurrentProject(headerName, "C++ Header File",
|
||||
expectedHeaderName=headerName)
|
||||
addCPlusPlusFile(headerName, "C++ Header File", "testfiles.pro",
|
||||
expectedHeaderName=headerName)
|
||||
if not testRenameMacroAfterSourceMoving():
|
||||
return
|
||||
invokeMenuItem("File", "Save All")
|
||||
|
@@ -34,9 +34,9 @@ def main():
|
||||
startApplication("qtcreator" + SettingsPath)
|
||||
if not startedWithoutPluginError():
|
||||
return
|
||||
addCPlusPlusFileToCurrentProject(newClassName, "C++ Class", newBasePath=basePath,
|
||||
expectedSourceName=sourceFileName,
|
||||
expectedHeaderName=headerFileName)
|
||||
addCPlusPlusFile(newClassName, "C++ Class", None, newBasePath=basePath,
|
||||
expectedSourceName=sourceFileName,
|
||||
expectedHeaderName=headerFileName)
|
||||
|
||||
mainWindow = waitForObject(":Qt Creator_Core::Internal::MainWindow")
|
||||
if test.verify(waitFor("sourceFileName in str(mainWindow.windowTitle)", 1000),
|
||||
@@ -77,17 +77,17 @@ def main():
|
||||
def overwritten(filename):
|
||||
return notOverwrittenComment not in readFile(os.path.join(basePath, filename))
|
||||
|
||||
addCPlusPlusFileToCurrentProject(newClassName, "C++ Class", False, newBasePath=basePath,
|
||||
expectedSourceName=sourceFileName,
|
||||
expectedHeaderName=headerFileName)
|
||||
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,
|
||||
expectedHeaderName=headerFileName)
|
||||
addCPlusPlusFile(newClassName, "C++ Class", None, True,
|
||||
newBasePath=basePath, expectedSourceName=sourceFileName,
|
||||
expectedHeaderName=headerFileName)
|
||||
test.verify(waitFor("overwritten(sourceFileName)", 2000),
|
||||
"Source file should be overwritten.")
|
||||
test.verify(waitFor("overwritten(headerFileName)", 500),
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user