summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cpptoolstestcase.h
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@theqtcompany.com>2014-12-09 13:01:44 +0100
committerErik Verbruggen <erik.verbruggen@theqtcompany.com>2014-12-19 10:24:48 +0100
commitef403a4515aa93272f6e5155b2897ddd02fb128e (patch)
tree13c652bceaddec4fddd10a80a5173e489791afc0 /src/plugins/cpptools/cpptoolstestcase.h
parent613304edfc6e18ae382f4662ffef78706870499f (diff)
downloadqt-creator-ef403a4515aa93272f6e5155b2897ddd02fb128e.tar.gz
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>
Diffstat (limited to 'src/plugins/cpptools/cpptoolstestcase.h')
-rw-r--r--src/plugins/cpptools/cpptoolstestcase.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cpptoolstestcase.h b/src/plugins/cpptools/cpptoolstestcase.h
index 5c90cf73b9..d20950ebb4 100644
--- a/src/plugins/cpptools/cpptoolstestcase.h
+++ b/src/plugins/cpptools/cpptoolstestcase.h
@@ -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: