add a test for the real implementation of WindowStateStorage
commita9b09855dc13397c28aa3885929d96d7e3357102
authorLukáš Tinkl <lukas.tinkl@canonical.com>
dateTue 3 Jan 2017, 17:07 (10 years ago)
parent82ff2e1
plugins/Utils/windowstatestorage.cpp+2−1
@@ -33,9 +33,10 @@ inline QString sanitiseString(QString string) {
3333 .remove(QLatin1Char('\\'));
3434}
3535
36−WindowStateStorage::WindowStateStorage(QObject *parent):
36+WindowStateStorage::WindowStateStorage(QObject *parent, bool testMode):
3737 QObject(parent)
3838{
39+ QStandardPaths::setTestModeEnabled(testMode);
3940 const QString dbPath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + QStringLiteral("/unity8/");
4041 m_db = QSqlDatabase::addDatabase(QStringLiteral("QSQLITE"));
4142 QDir dir;
plugins/Utils/windowstatestorage.h+1−1
@@ -47,7 +47,7 @@ public:
4747 Q_FLAG(WindowStates)
4848#endif
4949
50− WindowStateStorage(QObject *parent = nullptr);
50+ WindowStateStorage(QObject *parent = nullptr, bool testMode = false);
5151 virtual ~WindowStateStorage();
5252
5353 Q_INVOKABLE void saveState(const QString &windowId, WindowState state);
tests/plugins/Utils/CMakeLists.txt+1
@@ -11,6 +11,7 @@ foreach(util_test
1111 UnitySortFilterProxyModel
1212 WindowInputMonitor
1313 DeviceConfigParser
14+ WindowStateStorage
1415)
1516 add_executable(${util_test}TestExec ${util_test}Test.cpp ModelTest.cpp)
1617 qt5_use_modules(${util_test}TestExec Test Core Qml)