diff options
Diffstat (limited to 'common/test.cpp')
-rw-r--r-- | common/test.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/common/test.cpp b/common/test.cpp index 1062e21..59ad9ec 100644 --- a/common/test.cpp +++ b/common/test.cpp | |||
@@ -32,7 +32,7 @@ using namespace Sink; | |||
32 | 32 | ||
33 | void Sink::Test::initTest() | 33 | void Sink::Test::initTest() |
34 | { | 34 | { |
35 | QStandardPaths::setTestModeEnabled(true); | 35 | setTestModeEnabled(true); |
36 | // qDebug() << "Removing " << QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); | 36 | // qDebug() << "Removing " << QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); |
37 | QDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)).removeRecursively(); | 37 | QDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)).removeRecursively(); |
38 | // qDebug() << "Removing " << QStandardPaths::writableLocation(QStandardPaths::DataLocation); | 38 | // qDebug() << "Removing " << QStandardPaths::writableLocation(QStandardPaths::DataLocation); |
@@ -47,6 +47,20 @@ void Sink::Test::initTest() | |||
47 | QDir(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation)).removeRecursively(); | 47 | QDir(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation)).removeRecursively(); |
48 | } | 48 | } |
49 | 49 | ||
50 | void Sink::Test::setTestModeEnabled(bool enabled) | ||
51 | { | ||
52 | QStandardPaths::setTestModeEnabled(enabled); | ||
53 | if (enabled) { | ||
54 | qputenv("SINK_TESTMODE", "TRUE"); | ||
55 | } else { | ||
56 | qunsetenv("SINK_TESTMODE"); | ||
57 | } | ||
58 | } | ||
59 | |||
60 | bool Sink::Test::testModeEnabled() | ||
61 | { | ||
62 | return !qEnvironmentVariableIsEmpty("SINK_TESTMODE"); | ||
63 | } | ||
50 | 64 | ||
51 | template <typename T> | 65 | template <typename T> |
52 | class TestFacade : public Sink::StoreFacade<T> | 66 | class TestFacade : public Sink::StoreFacade<T> |