summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2020-06-16 13:11:10 +0200
committerChristian Stenger <christian.stenger@qt.io>2020-06-17 04:13:30 +0000
commit6e798401a0558ad039fff62b80e97660053b60b8 (patch)
treef894882d7b82428a3d452c7daf80f7f9958a0a18 /src/plugins/cpptools
parentc6db1c29d6274996b5c2f76291e7ff47f47d3405 (diff)
downloadqt-creator-6e798401a0558ad039fff62b80e97660053b60b8.tar.gz
Fix plugin unit tests when using projects
The ClangTools and the AutoTest plugins use an internal mechanism to load and configure a project when performing their integrated unit tests. Both assumed to have exactly one kit present for these tests. Make it possible to have more kits present when starting with existing settings or if more kits get automatically generated when starting with clean settings. Change-Id: If2bc66320c4854f1d34a19d17107e8f0b7d64d39 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/cpptools')
-rw-r--r--src/plugins/cpptools/cpptoolstestcase.cpp5
-rw-r--r--src/plugins/cpptools/cpptoolstestcase.h8
2 files changed, 9 insertions, 4 deletions
diff --git a/src/plugins/cpptools/cpptoolstestcase.cpp b/src/plugins/cpptools/cpptoolstestcase.cpp
index 23dc69e681..817c78993c 100644
--- a/src/plugins/cpptools/cpptoolstestcase.cpp
+++ b/src/plugins/cpptools/cpptoolstestcase.cpp
@@ -277,7 +277,8 @@ ProjectOpenerAndCloser::~ProjectOpenerAndCloser()
QCoreApplication::processEvents();
}
-ProjectInfo ProjectOpenerAndCloser::open(const QString &projectFile, bool configureAsExampleProject)
+ProjectInfo ProjectOpenerAndCloser::open(const QString &projectFile, bool configureAsExampleProject,
+ Kit *kit)
{
ProjectExplorerPlugin::OpenProjectResult result = ProjectExplorerPlugin::openProject(projectFile);
if (!result) {
@@ -287,7 +288,7 @@ ProjectInfo ProjectOpenerAndCloser::open(const QString &projectFile, bool config
Project *project = result.project();
if (configureAsExampleProject)
- project->configureAsExampleProject();
+ project->configureAsExampleProject(kit);
if (TestCase::waitUntilProjectIsFullyOpened(project)) {
m_openProjects.append(project);
diff --git a/src/plugins/cpptools/cpptoolstestcase.h b/src/plugins/cpptools/cpptoolstestcase.h
index d6e306d255..aaa94f1e07 100644
--- a/src/plugins/cpptools/cpptoolstestcase.h
+++ b/src/plugins/cpptools/cpptoolstestcase.h
@@ -38,7 +38,10 @@ class Snapshot;
}
namespace Core { class IEditor; }
-namespace ProjectExplorer { class Project; }
+namespace ProjectExplorer {
+class Kit;
+class Project;
+}
namespace TextEditor {
class BaseTextEditor;
@@ -118,7 +121,8 @@ public:
ProjectOpenerAndCloser();
~ProjectOpenerAndCloser(); // Closes opened projects
- ProjectInfo open(const QString &projectFile, bool configureAsExampleProject = false);
+ ProjectInfo open(const QString &projectFile, bool configureAsExampleProject = false,
+ ProjectExplorer::Kit *kit = nullptr);
private:
QList<ProjectExplorer::Project *> m_openProjects;