summaryrefslogtreecommitdiff
path: root/src/plugins/cppeditor/cppincludehierarchy_test.cpp
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@theqtcompany.com>2014-12-10 17:03:49 +0100
committerNikolai Kosjar <nikolai.kosjar@theqtcompany.com>2015-01-14 12:10:39 +0100
commitd9c70f43d97a035a951c9e504e5c56259dfdacdb (patch)
treeda1be0c91b0f05eaa7a06e3d0e07e06015cffeba /src/plugins/cppeditor/cppincludehierarchy_test.cpp
parent71c27ba4cc1806d8c56e92de0aebdc69ae385aa4 (diff)
downloadqt-creator-d9c70f43d97a035a951c9e504e5c56259dfdacdb.tar.gz
CppEditor: Tests: Use QTemporaryDir and avoid writing into creator source tree
This should improve results of CI tests where multiple creator instances execute the plugin tests. Change-Id: I557a0964568655662108df201589ba369096f4bf Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com> Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Diffstat (limited to 'src/plugins/cppeditor/cppincludehierarchy_test.cpp')
-rw-r--r--src/plugins/cppeditor/cppincludehierarchy_test.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/plugins/cppeditor/cppincludehierarchy_test.cpp b/src/plugins/cppeditor/cppincludehierarchy_test.cpp
index f016dd2c80..879b7a107f 100644
--- a/src/plugins/cppeditor/cppincludehierarchy_test.cpp
+++ b/src/plugins/cppeditor/cppincludehierarchy_test.cpp
@@ -82,22 +82,24 @@ public:
QSet<QString> filePaths;
const int sourceListSize = sourceList.size();
+
+ CppTools::Tests::TemporaryDir temporaryDir;
+ QVERIFY(temporaryDir.isValid());
+
for (int i = 0; i < sourceListSize; ++i) {
const QByteArray &source = sourceList.at(i);
// Write source to file
- const QString fileName = QString::fromLatin1("%1/file%2.h").arg(QDir::tempPath())
- .arg(i+1);
- QVERIFY(writeFile(fileName, source));
-
- filePaths << fileName;
+ const QString fileName = QString::fromLatin1("file%1.h").arg(i+1);
+ const QString absoluteFilePath = temporaryDir.createFile(fileName.toLatin1(), source);
+ filePaths << absoluteFilePath;
}
// Update Code Model
QVERIFY(parseFiles(filePaths));
// Open Editor
- const QString fileName = QDir::tempPath() + QLatin1String("/file1.h");
+ const QString fileName = temporaryDir.path() + QLatin1String("/file1.h");
CppEditor *editor;
QVERIFY(openCppEditor(fileName, &editor));
closeEditorAtEndOfTestCase(editor);