summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-01-05 16:17:51 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-01-08 16:26:38 +0100
commit0dc0b4be6e9ba07774efedee102a23e89eef8e85 (patch)
tree2d6c3a9388c5dde159ffbc72fdd6d0bd285741ed /components
parent772eeaa715551cbb4693ab221ea8fc6dad7e1bb6 (diff)
downloadkube-0dc0b4be6e9ba07774efedee102a23e89eef8e85.tar.gz
kube-0dc0b4be6e9ba07774efedee102a23e89eef8e85.zip
Composer test
Diffstat (limited to 'components')
-rw-r--r--components/kube/tests/tst_composerview.qml41
1 files changed, 34 insertions, 7 deletions
diff --git a/components/kube/tests/tst_composerview.qml b/components/kube/tests/tst_composerview.qml
index 4b0362a7..b7b6b3df 100644
--- a/components/kube/tests/tst_composerview.qml
+++ b/components/kube/tests/tst_composerview.qml
@@ -20,6 +20,7 @@
20import QtQuick 2.7 20import QtQuick 2.7
21import QtTest 1.0 21import QtTest 1.0
22import "../qml" 22import "../qml"
23import org.kube.framework 1.0 as Kube
23 24
24TestCase { 25TestCase {
25 id: testCase 26 id: testCase
@@ -33,24 +34,50 @@ TestCase {
33 focus: true 34 focus: true
34 } 35 }
35 36
36 function test_start() { 37 function test_1start() {
37 verify(composer) 38 verify(composer)
38 } 39 }
39 40
40 function test_verifyInitialFocus() { 41 function test_2verifyInitialFocus() {
41 var newMailButton = findChild(composer, "newMailButton"); 42 var newMailButton = findChild(composer, "newMailButton");
42 verify(newMailButton) 43 verify(newMailButton)
43 verify(newMailButton.activeFocus) 44 verify(newMailButton.activeFocus)
44 } 45 }
45 46
46 function test_sendMessage() { 47 Component {
47 var mail = null 48 id: controllerComponent
49 Kube.DomainObjectController {}
50 }
51
52 Component {
53 id: outboxComponent
54 Kube.OutboxModel {}
55 }
56
57 function test_3sendMessage() {
58 var domainObjectController = controllerComponent.createObject(null, {blocking: true})
59 var mail = {
60 type: "mail",
61 subject: "subject",
62 body: "body",
63 to: ["to@example.org"],
64 cc: ["cc@example.org"],
65 bcc: ["bcc@example.org"],
66 draft: true
67 }
68 domainObjectController.create(mail)
69
70 tryVerify(function(){ return domainObjectController.currentObject })
71 var createdMail = domainObjectController.currentObject
72 verify(createdMail)
73
48 var loadAsDraft = true 74 var loadAsDraft = true
49 composer.loadMessage(mail, loadAsDraft) 75 composer.loadMessage(createdMail, loadAsDraft)
50 var sendMailButton = findChild(composer, "sendButton") 76 var sendMailButton = findChild(composer, "sendButton")
51 verify(sendMailButton) 77 verify(sendMailButton)
52 verify(sendMailButton.enabled) 78 tryVerify(function(){ return sendMailButton.enabled })
53 sendMailButton.clicked() 79 sendMailButton.clicked()
54 //TODO verify the mail is sent 80 var outbox = outboxComponent.createObject(null, {})
81 tryCompare(outbox, "count", 1)
55 } 82 }
56} 83}