diff options
Diffstat (limited to 'common/test.cpp')
-rw-r--r-- | common/test.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/common/test.cpp b/common/test.cpp index 99e51c8..5b4c899 100644 --- a/common/test.cpp +++ b/common/test.cpp | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "facadefactory.h" | 27 | #include "facadefactory.h" |
28 | #include "query.h" | 28 | #include "query.h" |
29 | #include "resourceconfig.h" | 29 | #include "resourceconfig.h" |
30 | #include "definitions.h" | ||
30 | 31 | ||
31 | SINK_DEBUG_AREA("test") | 32 | SINK_DEBUG_AREA("test") |
32 | 33 | ||
@@ -34,6 +35,9 @@ using namespace Sink; | |||
34 | 35 | ||
35 | void Sink::Test::initTest() | 36 | void Sink::Test::initTest() |
36 | { | 37 | { |
38 | auto logIniFile = Sink::configLocation() + "/log.ini"; | ||
39 | auto areaAutocompletionFile = Sink::dataLocation() + "/debugAreas.ini"; | ||
40 | |||
37 | setTestModeEnabled(true); | 41 | setTestModeEnabled(true); |
38 | // qDebug() << "Removing " << QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); | 42 | // qDebug() << "Removing " << QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); |
39 | QDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)).removeRecursively(); | 43 | QDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)).removeRecursively(); |
@@ -48,6 +52,30 @@ void Sink::Test::initTest() | |||
48 | // qDebug() << "Removing " << QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation); | 52 | // qDebug() << "Removing " << QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation); |
49 | QDir(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation)).removeRecursively(); | 53 | QDir(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation)).removeRecursively(); |
50 | Log::setPrimaryComponent("test"); | 54 | Log::setPrimaryComponent("test"); |
55 | |||
56 | //We copy those files so we can control debug output from outside the test with sinksh | ||
57 | { | ||
58 | QFile file(logIniFile); | ||
59 | if (!file.open(QIODevice::ReadOnly)) { | ||
60 | qWarning() << "Failed to open the file: " << logIniFile; | ||
61 | } | ||
62 | QDir dir; | ||
63 | dir.mkpath(Sink::configLocation()); | ||
64 | if (!file.copy(Sink::configLocation() + "/log.ini")) { | ||
65 | qWarning() << "Failed to move the file: " << Sink::configLocation() + "/log.ini"; | ||
66 | } | ||
67 | } | ||
68 | { | ||
69 | QFile file(areaAutocompletionFile); | ||
70 | if (!file.open(QIODevice::ReadOnly)) { | ||
71 | qWarning() << "Failed to open the file: " << logIniFile; | ||
72 | } | ||
73 | QDir dir; | ||
74 | dir.mkpath(Sink::dataLocation()); | ||
75 | if (!file.copy(Sink::dataLocation() + "/debugAreas.ini")) { | ||
76 | qWarning() << "Failed to move the file: " << Sink::configLocation() + "/log.ini"; | ||
77 | } | ||
78 | } | ||
51 | } | 79 | } |
52 | 80 | ||
53 | void Sink::Test::setTestModeEnabled(bool enabled) | 81 | void Sink::Test::setTestModeEnabled(bool enabled) |