diff options
Diffstat (limited to 'views/conversation/tests/tst_conversationview.qml')
-rw-r--r-- | views/conversation/tests/tst_conversationview.qml | 89 |
1 files changed, 86 insertions, 3 deletions
diff --git a/views/conversation/tests/tst_conversationview.qml b/views/conversation/tests/tst_conversationview.qml index 467c049a..610c28b3 100644 --- a/views/conversation/tests/tst_conversationview.qml +++ b/views/conversation/tests/tst_conversationview.qml | |||
@@ -20,6 +20,8 @@ | |||
20 | import QtQuick 2.7 | 20 | import QtQuick 2.7 |
21 | import QtTest 1.0 | 21 | import QtTest 1.0 |
22 | import "../qml" | 22 | import "../qml" |
23 | import org.kube.framework 1.0 as Kube | ||
24 | import org.kube.test 1.0 | ||
23 | 25 | ||
24 | TestCase { | 26 | TestCase { |
25 | id: testCase | 27 | id: testCase |
@@ -27,11 +29,92 @@ TestCase { | |||
27 | height: 400 | 29 | height: 400 |
28 | name: "MailView" | 30 | name: "MailView" |
29 | 31 | ||
30 | View { | 32 | Component { |
31 | id: mailView | 33 | id: mailViewComponent |
34 | View { | ||
35 | focus: true | ||
36 | } | ||
32 | } | 37 | } |
33 | 38 | ||
34 | function test_start() { | 39 | function test_1start() { |
40 | var mailView = createTemporaryObject(mailViewComponent, testCase, {}) | ||
35 | verify(mailView) | 41 | verify(mailView) |
36 | } | 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 | } | ||
37 | } | 120 | } |