diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-01-11 14:39:57 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-01-11 14:40:19 +0100 |
commit | 89231902b7fa7d8c9143ebc775dc25013294f6a4 (patch) | |
tree | 048953157117b83ff9c940d79332aa6a8881eb59 | |
parent | 89f004a0cdc58056b93e5ef8d43969c99f8d743d (diff) | |
download | kube-89231902b7fa7d8c9143ebc775dc25013294f6a4.tar.gz kube-89231902b7fa7d8c9143ebc775dc25013294f6a4.zip |
More conversationview testing
-rw-r--r-- | framework/qml/ConversationView.qml | 1 | ||||
-rw-r--r-- | framework/qml/InlineAccountSwitcher.qml | 1 | ||||
-rw-r--r-- | framework/qml/MailListView.qml | 1 | ||||
-rw-r--r-- | tests/teststore.cpp | 11 | ||||
-rw-r--r-- | views/conversation/qml/View.qml | 3 | ||||
-rw-r--r-- | views/conversation/tests/tst_conversationview.qml | 89 |
6 files changed, 103 insertions, 3 deletions
diff --git a/framework/qml/ConversationView.qml b/framework/qml/ConversationView.qml index c4cdea32..c8ea74ae 100644 --- a/framework/qml/ConversationView.qml +++ b/framework/qml/ConversationView.qml | |||
@@ -53,6 +53,7 @@ FocusScope { | |||
53 | 53 | ||
54 | Kube.ConversationListView { | 54 | Kube.ConversationListView { |
55 | id: listView | 55 | id: listView |
56 | objectName: "listView" | ||
56 | focus: true | 57 | focus: true |
57 | 58 | ||
58 | anchors { | 59 | anchors { |
diff --git a/framework/qml/InlineAccountSwitcher.qml b/framework/qml/InlineAccountSwitcher.qml index 746891f9..b7f69588 100644 --- a/framework/qml/InlineAccountSwitcher.qml +++ b/framework/qml/InlineAccountSwitcher.qml | |||
@@ -74,6 +74,7 @@ FocusScope { | |||
74 | } | 74 | } |
75 | 75 | ||
76 | Kube.FolderListView { | 76 | Kube.FolderListView { |
77 | objectName: "folderListView" | ||
77 | anchors { | 78 | anchors { |
78 | top: accountButton.bottom | 79 | top: accountButton.bottom |
79 | left: parent.left | 80 | left: parent.left |
diff --git a/framework/qml/MailListView.qml b/framework/qml/MailListView.qml index 074f004c..f3e6a7a6 100644 --- a/framework/qml/MailListView.qml +++ b/framework/qml/MailListView.qml | |||
@@ -109,6 +109,7 @@ FocusScope { | |||
109 | 109 | ||
110 | Kube.ListView { | 110 | Kube.ListView { |
111 | id: listView | 111 | id: listView |
112 | objectName: "listView" | ||
112 | 113 | ||
113 | Layout.fillWidth: true | 114 | Layout.fillWidth: true |
114 | Layout.fillHeight: true | 115 | Layout.fillHeight: true |
diff --git a/tests/teststore.cpp b/tests/teststore.cpp index 294aca8f..4716fa2e 100644 --- a/tests/teststore.cpp +++ b/tests/teststore.cpp | |||
@@ -168,6 +168,17 @@ QVariant TestStore::load(const QByteArray &type, const QVariantMap &filter) | |||
168 | } | 168 | } |
169 | return {}; | 169 | return {}; |
170 | } | 170 | } |
171 | if (type == "folder") { | ||
172 | Sink::Query query; | ||
173 | if (filter.contains("resource")) { | ||
174 | query.resourceFilter(filter.value("resource").toByteArray()); | ||
175 | } | ||
176 | auto list = Sink::Store::read<Folder>(query); | ||
177 | if (!list.isEmpty()) { | ||
178 | return QVariant::fromValue(Folder::Ptr::create(list.first())); | ||
179 | } | ||
180 | return {}; | ||
181 | } | ||
171 | 182 | ||
172 | Q_ASSERT(false); | 183 | Q_ASSERT(false); |
173 | return {}; | 184 | return {}; |
diff --git a/views/conversation/qml/View.qml b/views/conversation/qml/View.qml index 8b2b0caf..7f1c78bb 100644 --- a/views/conversation/qml/View.qml +++ b/views/conversation/qml/View.qml | |||
@@ -35,6 +35,7 @@ FocusScope { | |||
35 | 35 | ||
36 | Kube.PositiveButton { | 36 | Kube.PositiveButton { |
37 | id: newMailButton | 37 | id: newMailButton |
38 | objectName: "newMailButton" | ||
38 | 39 | ||
39 | anchors { | 40 | anchors { |
40 | top: parent.top | 41 | top: parent.top |
@@ -104,6 +105,7 @@ FocusScope { | |||
104 | 105 | ||
105 | Kube.MailListView { | 106 | Kube.MailListView { |
106 | id: mailListView | 107 | id: mailListView |
108 | objectName: "mailListView" | ||
107 | anchors.fill: parent | 109 | anchors.fill: parent |
108 | activeFocusOnTab: true | 110 | activeFocusOnTab: true |
109 | Layout.minimumWidth: Kube.Units.gridUnit * 10 | 111 | Layout.minimumWidth: Kube.Units.gridUnit * 10 |
@@ -112,6 +114,7 @@ FocusScope { | |||
112 | 114 | ||
113 | Kube.ConversationView { | 115 | Kube.ConversationView { |
114 | id: mailView | 116 | id: mailView |
117 | objectName: "mailView" | ||
115 | Layout.fillWidth: true | 118 | Layout.fillWidth: true |
116 | Layout.fillHeight: parent.height | 119 | Layout.fillHeight: parent.height |
117 | activeFocusOnTab: true | 120 | activeFocusOnTab: true |
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 | } |