summaryrefslogtreecommitdiffstats
path: root/views/search/tests/tst_searchview.qml
diff options
context:
space:
mode:
Diffstat (limited to 'views/search/tests/tst_searchview.qml')
-rw-r--r--views/search/tests/tst_searchview.qml120
1 files changed, 120 insertions, 0 deletions
diff --git a/views/search/tests/tst_searchview.qml b/views/search/tests/tst_searchview.qml
new file mode 100644
index 00000000..610c28b3
--- /dev/null
+++ b/views/search/tests/tst_searchview.qml
@@ -0,0 +1,120 @@
1/*
2 * Copyright 2017 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 Library General Public License as
6 * published by the Free Software Foundation; either version 2, 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 Library General Public License for more details
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20import QtQuick 2.7
21import QtTest 1.0
22import "../qml"
23import org.kube.framework 1.0 as Kube
24import org.kube.test 1.0
25
26TestCase {
27 id: testCase
28 width: 400
29 height: 400
30 name: "MailView"
31
32 Component {
33 id: mailViewComponent
34 View {
35 focus: true
36 }
37 }
38
39 function test_1start() {
40 var mailView = createTemporaryObject(mailViewComponent, testCase, {})
41 verify(mailView)
42 }
43
44 function test_2verifyInitialFocus() {
45 var mailView = createTemporaryObject(mailViewComponent, testCase, {})
46 var newMailButton = findChild(mailView, "newMailButton");
47 verify(newMailButton)
48 // verify(newMailButton.activeFocus)
49 }
50
51 function test_3selectMessage() {
52 var initialState = {
53 accounts: [{
54 id: "account1",
55 name: "Test Account"
56 }],
57 identities: [{
58 account: "account1",
59 name: "Test Identity",
60 address: "identity@example.org"
61 }],
62 resources: [{
63 id: "resource1",
64 account: "account1",
65 type: "dummy"
66 },
67 {
68 id: "resource2",
69 account: "account1",
70 type: "mailtransport"
71 }],
72 folders: [{
73 id: "folder1",
74 resource: "resource1",
75 name: "Folder 1",
76 specialpurpose: ["inbox"],
77 mails: [{
78 resource: "resource1",
79 subject: "subject1",
80 body: "body",
81 to: ["to@example.org"],
82 cc: ["cc@example.org"],
83 bcc: ["bcc@example.org"],
84 draft: true
85 },
86 {
87 resource: "resource1",
88 subject: "subject2",
89 body: "body",
90 to: ["to@example.org"],
91 cc: ["cc@example.org"],
92 bcc: ["bcc@example.org"],
93 draft: true
94 }
95 ],
96 }],
97 }
98 TestStore.setup(initialState)
99 var mailView = createTemporaryObject(mailViewComponent, testCase, {})
100 var folderListView = findChild(mailView, "folderListView");
101 verify(folderListView)
102
103 var folder = TestStore.load("folder", {resource: "resource1"})
104 verify(folder)
105
106 Kube.Fabric.postMessage(Kube.Messages.folderSelection, {"folder": folder, "trash": false});
107
108 var mailListView = findChild(mailView, "mailListView");
109 verify(mailListView)
110 var listView = findChild(mailListView, "listView");
111 verify(listView)
112 tryCompare(listView, "count", 2)
113
114 var conversationView = findChild(mailView, "mailView");
115 verify(conversationView)
116 var listView = findChild(conversationView, "listView");
117 verify(listView)
118 // tryCompare(listView, "count", 2)
119 }
120}