diff options
-rw-r--r-- | tests/teststore.cpp | 13 | ||||
-rw-r--r-- | tests/teststore.h | 1 | ||||
-rw-r--r-- | views/composer/tests/tst_composerview.qml | 4 |
3 files changed, 18 insertions, 0 deletions
diff --git a/tests/teststore.cpp b/tests/teststore.cpp index 817101be..294aca8f 100644 --- a/tests/teststore.cpp +++ b/tests/teststore.cpp | |||
@@ -172,3 +172,16 @@ QVariant TestStore::load(const QByteArray &type, const QVariantMap &filter) | |||
172 | Q_ASSERT(false); | 172 | Q_ASSERT(false); |
173 | return {}; | 173 | return {}; |
174 | } | 174 | } |
175 | |||
176 | QVariantMap TestStore::read(const QVariant &object) | ||
177 | { | ||
178 | using namespace Sink::ApplicationDomain; | ||
179 | QVariantMap map; | ||
180 | if (auto mail = object.value<Mail::Ptr>()) { | ||
181 | map.insert("subject", mail->getSubject()); | ||
182 | map.insert("draft", mail->getDraft()); | ||
183 | return map; | ||
184 | } | ||
185 | Q_ASSERT(false); | ||
186 | return {}; | ||
187 | } | ||
diff --git a/tests/teststore.h b/tests/teststore.h index e8fce6da..5df20416 100644 --- a/tests/teststore.h +++ b/tests/teststore.h | |||
@@ -28,6 +28,7 @@ class TestStore : public QObject { | |||
28 | public: | 28 | public: |
29 | Q_INVOKABLE void setup(const QVariantMap &); | 29 | Q_INVOKABLE void setup(const QVariantMap &); |
30 | Q_INVOKABLE QVariant load(const QByteArray &type, const QVariantMap &); | 30 | Q_INVOKABLE QVariant load(const QByteArray &type, const QVariantMap &); |
31 | Q_INVOKABLE QVariantMap read(const QVariant &); | ||
31 | }; | 32 | }; |
32 | 33 | ||
33 | } | 34 | } |
diff --git a/views/composer/tests/tst_composerview.qml b/views/composer/tests/tst_composerview.qml index eac391c1..aa427d3f 100644 --- a/views/composer/tests/tst_composerview.qml +++ b/views/composer/tests/tst_composerview.qml | |||
@@ -93,5 +93,9 @@ TestCase { | |||
93 | 93 | ||
94 | tryVerify(function(){ return TestStore.load("mail", {resource: "resource2"}) }) | 94 | tryVerify(function(){ return TestStore.load("mail", {resource: "resource2"}) }) |
95 | tryVerify(function(){ return !TestStore.load("mail", {resource: "resource1"}) }) | 95 | tryVerify(function(){ return !TestStore.load("mail", {resource: "resource1"}) }) |
96 | |||
97 | var outgoingMail = TestStore.read(TestStore.load("mail", {resource: "resource2"})) | ||
98 | compare(outgoingMail.subject, "subject") | ||
99 | compare(outgoingMail.draft, false) | ||
96 | } | 100 | } |
97 | } | 101 | } |