summaryrefslogtreecommitdiffstats
path: root/common/test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/test.cpp')
-rw-r--r--common/test.cpp16
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
33void Sink::Test::initTest() 33void 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
50void 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
60bool Sink::Test::testModeEnabled()
61{
62 return !qEnvironmentVariableIsEmpty("SINK_TESTMODE");
63}
50 64
51template <typename T> 65template <typename T>
52class TestFacade : public Sink::StoreFacade<T> 66class TestFacade : public Sink::StoreFacade<T>