@@ -0,0 +1,59 @@
2+ * Copyright (C) 2017 Canonical, Ltd.
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17+#include "windowstatestorage.h"
21+class WindowStateStorageTest : public QObject
28+ storage = new WindowStateStorage(this, true /* testMode */);
36+ void testSaveRestoreState() {
37+ const WindowStateStorage::WindowState state{WindowStateStorage::WindowState::WindowStateMaximizedTopLeft};
38+ storage->saveState(QTest::currentTestFunction(), state);
39+ QTRY_COMPARE(storage->getState(QTest::currentTestFunction(), WindowStateStorage::WindowState::WindowStateNormal), state);
42+ void testSaveRestoreGeometry() {
43+ const QRect geometry{10, 20, 30, 40};
44+ storage->saveGeometry(QTest::currentTestFunction(), geometry);
45+ QTRY_COMPARE(storage->getGeometry(QTest::currentTestFunction(), QRect()), geometry);
48+ void testSaveRestoreStage() {
50+ storage->saveStage(QTest::currentTestFunction(), stage);
51+ QTRY_COMPARE(storage->getStage(QTest::currentTestFunction(), 0), stage);
55+ WindowStateStorage * storage{nullptr};
58+QTEST_GUILESS_MAIN(WindowStateStorageTest)
59+#include "WindowStateStorageTest.moc"