summaryrefslogtreecommitdiffstats
path: root/tests/maildirresourcetest.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-02-05 17:33:08 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-02-05 18:14:43 +0100
commit47bfba0d9152a1f7f689d7936b107b1a899a0b76 (patch)
treed3097b1da7bc87984bd7fdffbf803ed682e95fcc /tests/maildirresourcetest.cpp
parentb9a79ed514e7ab6bab0d6dedfcb9a78387d2b7c1 (diff)
downloadsink-47bfba0d9152a1f7f689d7936b107b1a899a0b76.tar.gz
sink-47bfba0d9152a1f7f689d7936b107b1a899a0b76.zip
Use property transformation for the mimeMessage
The filepath changes with every flag change. It is thus easier to only store a limited path that remains stable, and figure out the rest as the property is requested (we'll have to translate it anyways once we the file handoff protocol is implemented). The reason why we don't update the mimeMessage path on every modification is because we move the message during change replay, and not while storing the modification in the db. This would lead to the message-path on disk not correspond to what is in the db for some time.
Diffstat (limited to 'tests/maildirresourcetest.cpp')
-rw-r--r--tests/maildirresourcetest.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/maildirresourcetest.cpp b/tests/maildirresourcetest.cpp
index 7cdfc36..e502d10 100644
--- a/tests/maildirresourcetest.cpp
+++ b/tests/maildirresourcetest.cpp
@@ -158,6 +158,9 @@ private Q_SLOTS:
158 QVERIFY(!mail->getProperty("subject").toString().isEmpty()); 158 QVERIFY(!mail->getProperty("subject").toString().isEmpty());
159 QVERIFY(!mail->getProperty("mimeMessage").toString().isEmpty()); 159 QVERIFY(!mail->getProperty("mimeMessage").toString().isEmpty());
160 QVERIFY(mail->getProperty("date").toDateTime().isValid()); 160 QVERIFY(mail->getProperty("date").toDateTime().isValid());
161
162 QFileInfo info(mail->getProperty("mimeMessage").toString());
163 QVERIFY(info.exists());
161 } 164 }
162 165
163 166
@@ -368,10 +371,11 @@ private Q_SLOTS:
368 result.waitForFinished(); 371 result.waitForFinished();
369 QVERIFY(!result.errorCode()); 372 QVERIFY(!result.errorCode());
370 373
374 //Verify that we can still query for all relevant information
371 auto result2 = Store::fetchAll<Mail>( 375 auto result2 = Store::fetchAll<Mail>(
372 Query::ResourceFilter("org.kde.maildir.instance1") + Query::PropertyFilter("folder", f) + Query::RequestedProperties(QByteArrayList() << "folder" << "subject") 376 Query::ResourceFilter("org.kde.maildir.instance1") + Query::PropertyFilter("folder", f) + Query::RequestedProperties(QByteArrayList() << "folder" << "subject" << "mimeMessage" << "unread")
373 ) 377 )
374 .then<void, KAsync::Job<void>, QList<Mail::Ptr> >([query](const QList<Mail::Ptr> &mails) { 378 .then<void, KAsync::Job<void>, QList<Mail::Ptr> >([](const QList<Mail::Ptr> &mails) {
375 //Can't use QCOMPARE because it tries to return FIXME Implement ASYNCCOMPARE 379 //Can't use QCOMPARE because it tries to return FIXME Implement ASYNCCOMPARE
376 if (mails.size() != 1) { 380 if (mails.size() != 1) {
377 qWarning() << "Wrong number of mails"; 381 qWarning() << "Wrong number of mails";
@@ -382,6 +386,15 @@ private Q_SLOTS:
382 qWarning() << "Wrong subject"; 386 qWarning() << "Wrong subject";
383 return KAsync::error<void>(1, "Wrong subject."); 387 return KAsync::error<void>(1, "Wrong subject.");
384 } 388 }
389 if (mail->getProperty("unread").toBool() != true) {
390 qWarning() << "Not unread";
391 return KAsync::error<void>(1, "Not unread.");
392 }
393 QFileInfo info(mail->getProperty("mimeMessage").toString());
394 if (!info.exists()) {
395 qWarning() << "Wrong subject";
396 return KAsync::error<void>(1, "Can't find mime message.");
397 }
385 return KAsync::null<void>(); 398 return KAsync::null<void>();
386 }) 399 })
387 .exec(); 400 .exec();