// 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 #include 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 updateProjectInfo(const ProjectInfo::ConstPtr &projectInfo); void resetRefreshedSourceFiles(); QSet waitForRefreshedSourceFiles(); void waitForFinishedGc(); signals: void aboutToRemoveProject(Project *project); void projectAdded(Project*); public slots: void sourceFilesRefreshed(const QSet &files); void gcFinished(); private: bool m_gcFinished; bool m_refreshHappened; bool m_testOnlyForCleanedProjects; QSet m_lastRefreshedSourceFiles; QList m_projects; }; } // namespace CppEditor::Tests