diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-01-10 17:59:02 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-01-10 17:59:02 +0100 |
commit | d24d1d070c986e57a004cf58b15bf3123f065abf (patch) | |
tree | 5e132e4f325253508a7072b51e630d2a1a5b9e4e | |
parent | 7aef4eb3c0469b4780a06379facf2a7970f8813e (diff) | |
download | kube-d24d1d070c986e57a004cf58b15bf3123f065abf.tar.gz kube-d24d1d070c986e57a004cf58b15bf3123f065abf.zip |
InboxCrusher testsetup
-rw-r--r-- | tests/teststore.cpp | 10 | ||||
-rw-r--r-- | views/inboxcrusher/main.qml | 85 |
2 files changed, 95 insertions, 0 deletions
diff --git a/tests/teststore.cpp b/tests/teststore.cpp index d57c9e07..aafd56aa 100644 --- a/tests/teststore.cpp +++ b/tests/teststore.cpp | |||
@@ -47,6 +47,15 @@ static QStringList toStringList(const QVariantList &list) | |||
47 | return s; | 47 | return s; |
48 | } | 48 | } |
49 | 49 | ||
50 | static QByteArrayList toByteArrayList(const QVariantList &list) | ||
51 | { | ||
52 | QByteArrayList s; | ||
53 | for (const auto &e : list) { | ||
54 | s << e.toByteArray(); | ||
55 | } | ||
56 | return s; | ||
57 | } | ||
58 | |||
50 | static void createMail(const QVariantMap &object, const QByteArray &folder = {}) | 59 | static void createMail(const QVariantMap &object, const QByteArray &folder = {}) |
51 | { | 60 | { |
52 | using namespace Sink::ApplicationDomain; | 61 | using namespace Sink::ApplicationDomain; |
@@ -82,6 +91,7 @@ static void createFolder(const QVariantMap &object) | |||
82 | using namespace Sink::ApplicationDomain; | 91 | using namespace Sink::ApplicationDomain; |
83 | auto folder = ApplicationDomainType::createEntity<Folder>(object["resource"].toByteArray()); | 92 | auto folder = ApplicationDomainType::createEntity<Folder>(object["resource"].toByteArray()); |
84 | folder.setName(object["name"].toString()); | 93 | folder.setName(object["name"].toString()); |
94 | folder.setSpecialPurpose(toByteArrayList(object["specialpurpose"].toList())); | ||
85 | Sink::Store::create(folder).exec().waitForFinished(); | 95 | Sink::Store::create(folder).exec().waitForFinished(); |
86 | 96 | ||
87 | iterateOverObjects(object.value("mails").toList(), [=](const QVariantMap &object) { | 97 | iterateOverObjects(object.value("mails").toList(), [=](const QVariantMap &object) { |
diff --git a/views/inboxcrusher/main.qml b/views/inboxcrusher/main.qml new file mode 100644 index 00000000..c3b40e38 --- /dev/null +++ b/views/inboxcrusher/main.qml | |||
@@ -0,0 +1,85 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2018 Christian Mollekopf, <mollekopf@kolabsys.com> | ||
3 | * | ||
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; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along | ||
15 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | ||
18 | |||
19 | import QtQuick 2.7 | ||
20 | import QtQuick.Controls 2.0 | ||
21 | import QtQuick.Window 2.0 | ||
22 | |||
23 | import org.kube.framework 1.0 as Kube | ||
24 | import org.kube.test 1.0 | ||
25 | import "qml" | ||
26 | |||
27 | ApplicationWindow { | ||
28 | id: app | ||
29 | height: Screen.desktopAvailableHeight * 0.8 | ||
30 | width: Screen.desktopAvailableWidth * 0.8 | ||
31 | |||
32 | Component.onCompleted: { | ||
33 | var initialState = { | ||
34 | accounts: [{ | ||
35 | id: "account1", | ||
36 | name: "Test Account" | ||
37 | }], | ||
38 | identities: [{ | ||
39 | account: "account1", | ||
40 | name: "Test Identity", | ||
41 | address: "identity@example.org" | ||
42 | }], | ||
43 | resources: [{ | ||
44 | id: "resource1", | ||
45 | account: "account1", | ||
46 | type: "dummy" | ||
47 | }, | ||
48 | { | ||
49 | id: "resource2", | ||
50 | account: "account1", | ||
51 | type: "mailtransport" | ||
52 | }], | ||
53 | folders: [{ | ||
54 | id: "folder1", | ||
55 | resource: "resource1", | ||
56 | name: "Folder 1", | ||
57 | specialpurpose: ["inbox"], | ||
58 | mails: [{ | ||
59 | resource: "resource1", | ||
60 | subject: "subject1", | ||
61 | body: "body", | ||
62 | to: ["to@example.org"], | ||
63 | cc: ["cc@example.org"], | ||
64 | bcc: ["bcc@example.org"], | ||
65 | draft: true | ||
66 | }, | ||
67 | { | ||
68 | resource: "resource1", | ||
69 | subject: "subject2", | ||
70 | body: "body", | ||
71 | to: ["to@example.org"], | ||
72 | cc: ["cc@example.org"], | ||
73 | bcc: ["bcc@example.org"], | ||
74 | draft: true | ||
75 | } | ||
76 | ], | ||
77 | }], | ||
78 | } | ||
79 | TestStore.setup(initialState) | ||
80 | } | ||
81 | |||
82 | View { | ||
83 | anchors.fill: parent | ||
84 | } | ||
85 | } | ||