summaryrefslogtreecommitdiffstats
path: root/views/composer/tests/tst_composerview.qml
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-01-09 09:35:59 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-01-10 12:42:13 +0100
commit6d726bb10386b3d7f5481d41b735ec06cb2163ad (patch)
tree4d591b67b54c5a83f9f1d718a4576c8ccf05859b /views/composer/tests/tst_composerview.qml
parent2d9944bd0b5cd1dd202d9dc6318d612e1aca4241 (diff)
downloadkube-6d726bb10386b3d7f5481d41b735ec06cb2163ad.tar.gz
kube-6d726bb10386b3d7f5481d41b735ec06cb2163ad.zip
Install composer/converations/people as separate views and load them
dynamically.
Diffstat (limited to 'views/composer/tests/tst_composerview.qml')
-rw-r--r--views/composer/tests/tst_composerview.qml97
1 files changed, 97 insertions, 0 deletions
diff --git a/views/composer/tests/tst_composerview.qml b/views/composer/tests/tst_composerview.qml
new file mode 100644
index 00000000..eac391c1
--- /dev/null
+++ b/views/composer/tests/tst_composerview.qml
@@ -0,0 +1,97 @@
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: "ComposerView"
31 when: windowShown
32
33 Component {
34 id:composerComponent
35 View {
36 focus: true
37 }
38 }
39
40 function test_1start() {
41 var composer = createTemporaryObject(composerComponent, testCase, {})
42 verify(composer)
43 }
44
45 function test_2verifyInitialFocus() {
46 var composer = createTemporaryObject(composerComponent, testCase, {})
47 var newMailButton = findChild(composer, "newMailButton");
48 verify(newMailButton)
49 verify(newMailButton.activeFocus)
50 }
51
52 function test_3sendMessage() {
53 var initialState = {
54 accounts: [{
55 id: "account1",
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 mails:[{
73 resource: "resource1",
74 subject: "subject",
75 body: "body",
76 to: ["to@example.org"],
77 cc: ["cc@example.org"],
78 bcc: ["bcc@example.org"],
79 draft: true
80 }]
81 }
82 TestStore.setup(initialState)
83 var composer = createTemporaryObject(composerComponent, testCase, {})
84
85 var createdMail = TestStore.load("mail", {resource: "resource1"})
86
87 var loadAsDraft = true
88 composer.loadMessage(createdMail, loadAsDraft)
89 var sendMailButton = findChild(composer, "sendButton")
90 verify(sendMailButton)
91 tryVerify(function(){ return sendMailButton.enabled })
92 sendMailButton.clicked()
93
94 tryVerify(function(){ return TestStore.load("mail", {resource: "resource2"}) })
95 tryVerify(function(){ return !TestStore.load("mail", {resource: "resource1"}) })
96 }
97}