From fc7aafe08f922fb15d077304b130071bb9e69392 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Mon, 26 Feb 2018 14:38:03 +0100 Subject: Finishing test log view + proper message display in log view --- tests/teststore.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests') diff --git a/tests/teststore.cpp b/tests/teststore.cpp index e5a3ea88..24067f4f 100644 --- a/tests/teststore.cpp +++ b/tests/teststore.cpp @@ -160,6 +160,9 @@ QVariant TestStore::load(const QByteArray &type, const QVariantMap &filter) using namespace Sink::ApplicationDomain; const auto list = loadList(type, filter); if (!list.isEmpty()) { + if(list.size() > 1) { + qWarning() << "While loading" << type << "with filter" << filter << "; got multiple elements, but returning the first one."; + } return list.first(); } return {}; @@ -183,6 +186,17 @@ QVariantList TestStore::loadList(const QByteArray &type, const QVariantMap &filt if (filter.contains("resource")) { query.resourceFilter(filter.value("resource").toByteArray()); } + + for(QVariantMap::const_iterator it = filter.begin(); it != filter.end(); ++it) { + if(it.key() == "messageId") { + query.filter(it.value()); + } else if(it.key() == "draft") { + query.filter(it.value()); + } else if(it.key() == "subject") { + query.filter(it.value()); + } + } + if (type == "mail") { return toVariantList(Sink::Store::read(query)); } @@ -205,6 +219,7 @@ QVariantMap TestStore::read(const QVariant &object) using namespace Sink::ApplicationDomain; QVariantMap map; if (auto mail = object.value()) { + map.insert("uid", mail->identifier()); map.insert("subject", mail->getSubject()); map.insert("draft", mail->getDraft()); return map; -- cgit v1.2.3