blob: f1cfcca3cd2e9ae3b83e0d4595fa7faace04d126 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once
#include "cppeditor_global.h"
#include "cppmodelmanager.h"
#include <projectexplorer/project.h>
#include <QObject>
namespace CppEditor::Tests {
class CPPEDITOR_EXPORT TestProject: public ProjectExplorer::Project
{
Q_OBJECT
public:
TestProject(const QString &name, QObject *parent, const Utils::FilePath &filePath = {});
bool needsConfiguration() const final { return false; }
private:
QString m_name;
};
class CPPEDITOR_EXPORT ModelManagerTestHelper: public QObject
{
Q_OBJECT
public:
using Project = ProjectExplorer::Project;
explicit ModelManagerTestHelper(QObject *parent = nullptr,
bool testOnlyForCleanedProjects = true);
~ModelManagerTestHelper() override;
void cleanup();
Project *createProject(const QString &name, const Utils::FilePath &filePath = {});
QSet<Utils::FilePath> updateProjectInfo(const ProjectInfo::ConstPtr &projectInfo);
void resetRefreshedSourceFiles();
QSet<QString> waitForRefreshedSourceFiles();
void waitForFinishedGc();
signals:
void aboutToRemoveProject(Project *project);
void projectAdded(Project*);
public slots:
void sourceFilesRefreshed(const QSet<QString> &files);
void gcFinished();
private:
bool m_gcFinished;
bool m_refreshHappened;
bool m_testOnlyForCleanedProjects;
QSet<QString> m_lastRefreshedSourceFiles;
QList<Project *> m_projects;
};
} // namespace CppEditor::Tests
|