summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-01-31 14:35:28 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-01-31 14:35:28 +0100
commit342b0332b895534e5a7083aa5a1cf4cf1aa120f3 (patch)
tree93898d00d50d3acdce6a79c15ebdf012d82f560d
parentb37e7ce72bc9db14e777aa22dd631f3eebea4822 (diff)
downloadkube-342b0332b895534e5a7083aa5a1cf4cf1aa120f3.tar.gz
kube-342b0332b895534e5a7083aa5a1cf4cf1aa120f3.zip
Ensure that we can load replies.
The webengine based code we use to create replies needs a QApplication.
-rw-r--r--tests/kubetestrunner.cpp2
-rw-r--r--views/composer/qml/View.qml1
-rw-r--r--views/composer/tests/tst_composerview.qml42
3 files changed, 45 insertions, 0 deletions
diff --git a/tests/kubetestrunner.cpp b/tests/kubetestrunner.cpp
index 99017a43..d2c7331c 100644
--- a/tests/kubetestrunner.cpp
+++ b/tests/kubetestrunner.cpp
@@ -18,10 +18,12 @@
18*/ 18*/
19#include <QtQuickTest/quicktest.h> 19#include <QtQuickTest/quicktest.h>
20#include <QQmlEngine> 20#include <QQmlEngine>
21#include <QApplication>
21#include <sink/test.h> 22#include <sink/test.h>
22 23
23int main(int argc, char **argv) 24int main(int argc, char **argv)
24{ 25{
26 QApplication app(argc, argv);
25 QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true); 27 QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
26 28
27 QTEST_ADD_GPU_BLACKLIST_SUPPORT 29 QTEST_ADD_GPU_BLACKLIST_SUPPORT
diff --git a/views/composer/qml/View.qml b/views/composer/qml/View.qml
index 6fd3d07a..f81901c4 100644
--- a/views/composer/qml/View.qml
+++ b/views/composer/qml/View.qml
@@ -247,6 +247,7 @@ Kube.View {
247 247
248 Kube.TextField { 248 Kube.TextField {
249 id: subject 249 id: subject
250 objectName: "subject"
250 Layout.fillWidth: true 251 Layout.fillWidth: true
251 activeFocusOnTab: true 252 activeFocusOnTab: true
252 253
diff --git a/views/composer/tests/tst_composerview.qml b/views/composer/tests/tst_composerview.qml
index 57339b78..b26bf762 100644
--- a/views/composer/tests/tst_composerview.qml
+++ b/views/composer/tests/tst_composerview.qml
@@ -98,4 +98,46 @@ TestCase {
98 compare(outgoingMail.subject, "subject") 98 compare(outgoingMail.subject, "subject")
99 compare(outgoingMail.draft, false) 99 compare(outgoingMail.draft, false)
100 } 100 }
101
102 function test_4loadReply() {
103 var initialState = {
104 accounts: [{
105 id: "account1",
106 }],
107 identities: [{
108 account: "account1",
109 name: "Test Identity",
110 address: "identity@example.org"
111 }],
112 resources: [{
113 id: "resource1",
114 account: "account1",
115 type: "dummy"
116 },
117 {
118 id: "resource2",
119 account: "account1",
120 type: "mailtransport"
121 }],
122 mails:[{
123 resource: "resource1",
124 subject: "subject",
125 body: "body",
126 to: ["to@example.org"],
127 cc: ["cc@example.org"],
128 bcc: ["bcc@example.org"],
129 }]
130 }
131 TestStore.setup(initialState)
132 var composer = createTemporaryObject(composerComponent, testCase, {})
133
134 var createdMail = TestStore.load("mail", {resource: "resource1"})
135
136 var loadAsDraft = false
137 composer.loadMessage(createdMail, loadAsDraft)
138 var subject = findChild(composer, "subject");
139 verify(subject)
140 tryVerify(function(){ return subject.text == "RE: subject" })
141 tryVerify(function(){ return subject.body != "" })
142 }
101} 143}