Commit 16becbd2 authored by Nikolai Kosjar's avatar Nikolai Kosjar
Browse files

Plugin Tests: Create settings dir with QTemporaryDir

Create a clean and unique settings directory for "-test" runs if no
settings path is provided explicitly.

Change-Id: Ida2f5a74d42a5292963dd8d5d1f9dcddcdd24fd4
Reviewed-by: default avatarChristian Stenger <>
parent fd6ba0e2
......@@ -56,6 +56,7 @@
#include <QApplication>
#include <QMessageBox>
#include <QStandardPaths>
#include <QTemporaryDir>
#include <qtsystemexceptionhandler.h>
......@@ -338,10 +339,14 @@ int main(int argc, char **argv)
testOptionProvided = true;
QScopedPointer<QTemporaryDir> temporaryCleanSettingsDir;
if (settingsPath.isEmpty() && testOptionProvided) {
settingsPath = QDir::tempPath() + QString::fromLatin1("/qtc-%1-test-settings")
settingsPath = QDir::cleanPath(settingsPath);
const QString settingsPathTemplate = QDir::cleanPath(QDir::tempPath()
+ QString::fromLatin1("/qtc-test-settings-XXXXXX"));
temporaryCleanSettingsDir.reset(new QTemporaryDir(settingsPathTemplate));
if (!temporaryCleanSettingsDir->isValid())
return 1;
settingsPath = temporaryCleanSettingsDir->path();
if (!settingsPath.isEmpty())
QSettings::setPath(QSettings::IniFormat, QSettings::UserScope, settingsPath);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment