diff --git a/tests/system/objects.map b/tests/system/objects.map
index fe5a4ea296e..e855d701b52 100644
--- a/tests/system/objects.map
+++ b/tests/system/objects.map
@@ -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?='qmake: 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'}
diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py
index fa03531e720..d3f47b73e51 100644
--- a/tests/system/shared/project.py
+++ b/tests/system/shared/project.py
@@ -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="",
- newBasePath=None, expectedSourceName=None, expectedHeaderName=None):
+def addCPlusPlusFile(name, template, projectName, forceOverwrite=False, addToVCS="",
+ 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 = ""
+ 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"))
diff --git a/tests/system/suite_editors/tst_rename_macros/test.py b/tests/system/suite_editors/tst_rename_macros/test.py
index 067831da7d8..581247bfdfb 100644
--- a/tests/system/suite_editors/tst_rename_macros/test.py
+++ b/tests/system/suite_editors/tst_rename_macros/test.py
@@ -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")
diff --git a/tests/system/suite_general/tst_new_class/test.py b/tests/system/suite_general/tst_new_class/test.py
index d7b37abddcd..7f1f056908b 100644
--- a/tests/system/suite_general/tst_new_class/test.py
+++ b/tests/system/suite_general/tst_new_class/test.py
@@ -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),
diff --git a/tests/system/suite_tools/tst_git_local/test.py b/tests/system/suite_tools/tst_git_local/test.py
index eda76fea5c7..a9186a228f1 100644
--- a/tests/system/suite_tools/tst_git_local/test.py
+++ b/tests/system/suite_tools/tst_git_local/test.py
@@ -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)