forked from qt-creator/qt-creator
GenericProjectManager: Tests: Clean up
* Get rid of CppModelManagerHelper. Now we simply use CppModelManager::projectInfo(someProject).isValid() to test whether a project is loaded. * Copy project data to temporary dir before opening the projects. This avoids creating *.user files in the Qt Creator source tree and annoying pop ups on test start. Change-Id: I1a57441ca2099beb6bb96cf620390d669fb47601 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
committed by
Erik Verbruggen
parent
613304edfc
commit
ef403a4515
@@ -37,6 +37,7 @@
|
||||
#include <coreplugin/editormanager/ieditor.h>
|
||||
|
||||
#include <QStringList>
|
||||
#include <QTemporaryDir>
|
||||
|
||||
namespace CPlusPlus {
|
||||
class Document;
|
||||
@@ -44,6 +45,7 @@ class Snapshot;
|
||||
}
|
||||
|
||||
namespace Core { class IEditor; }
|
||||
namespace ProjectExplorer { class Project; }
|
||||
|
||||
namespace TextEditor {
|
||||
class BaseTextEditor;
|
||||
@@ -87,6 +89,8 @@ public:
|
||||
static CPlusPlus::Snapshot globalSnapshot();
|
||||
static bool garbageCollectGlobalSnapshot();
|
||||
|
||||
static bool waitUntilCppModelManagerIsAwareOf(ProjectExplorer::Project *project,
|
||||
int timeOut = 30 * 1000 /*= 30 secs*/);
|
||||
static CPlusPlus::Document::Ptr waitForFileInGlobalSnapshot(const QString &filePath);
|
||||
static QList<CPlusPlus::Document::Ptr> waitForFilesInGlobalSnapshot(
|
||||
const QStringList &filePaths);
|
||||
@@ -102,6 +106,32 @@ private:
|
||||
bool m_runGarbageCollector;
|
||||
};
|
||||
|
||||
class CPPTOOLS_EXPORT ProjectOpenerAndCloser
|
||||
{
|
||||
public:
|
||||
ProjectOpenerAndCloser();
|
||||
~ProjectOpenerAndCloser(); // Closes opened projects
|
||||
|
||||
ProjectInfo open(const QString &projectFile);
|
||||
|
||||
private:
|
||||
QList<ProjectExplorer::Project *> m_openProjects;
|
||||
};
|
||||
|
||||
class CPPTOOLS_EXPORT TemporaryCopiedDir
|
||||
{
|
||||
public:
|
||||
TemporaryCopiedDir(const QString &sourceDirPath);
|
||||
|
||||
bool isValid() const { return m_isValid; }
|
||||
QString path() const { return m_temporaryDir.path(); }
|
||||
QString absolutePath(const QByteArray &relativePath) const;
|
||||
|
||||
private:
|
||||
QTemporaryDir m_temporaryDir;
|
||||
bool m_isValid;
|
||||
};
|
||||
|
||||
class FileWriterAndRemover
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user