From b86ffa5a6e7884fb7a25fa84358de3caaeff11e8 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 26 Jun 2016 14:47:15 +0200 Subject: Dummyresource mailtest --- common/domain/applicationdomaintype.cpp | 12 ++++++++++++ common/domain/applicationdomaintype.h | 3 +++ examples/dummyresource/resourcefactory.cpp | 3 ++- tests/CMakeLists.txt | 1 + tests/dummyresourcemailtest.cpp | 29 +++++++++++++++++++++++++++++ 5 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 tests/dummyresourcemailtest.cpp diff --git a/common/domain/applicationdomaintype.cpp b/common/domain/applicationdomaintype.cpp index d1faf25..44eeb13 100644 --- a/common/domain/applicationdomaintype.cpp +++ b/common/domain/applicationdomaintype.cpp @@ -247,6 +247,18 @@ Identity::~Identity() } +namespace DummyResource { + SinkResource create(const QByteArray &account) + { + auto &&resource = ApplicationDomainType::createEntity(); + resource.setProperty("type", "org.kde.dummy"); + resource.setProperty("account", account); + resource.setProperty("capabilities", QVariant::fromValue(QByteArrayList() << ResourceCapabilities::Mail::storage << "-folder.rename")); + // resource.setProperty("capabilities", QVariant::fromValue(QByteArrayList() << ResourceCapabilities::Mail::storage << ResourceCapabilities::Mail::drafts << "-folder.rename" << ResourceCapabilities::Mail::trash)); + return resource; + } +} + namespace MaildirResource { SinkResource create(const QByteArray &account) { diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h index 928ea58..849c3e2 100644 --- a/common/domain/applicationdomaintype.h +++ b/common/domain/applicationdomaintype.h @@ -244,6 +244,9 @@ struct SINK_EXPORT Identity : public ApplicationDomainType { virtual ~Identity(); }; +namespace DummyResource { + SinkResource SINK_EXPORT create(const QByteArray &account); +}; namespace MaildirResource { SinkResource SINK_EXPORT create(const QByteArray &account); }; diff --git a/examples/dummyresource/resourcefactory.cpp b/examples/dummyresource/resourcefactory.cpp index a443581..2bd52cc 100644 --- a/examples/dummyresource/resourcefactory.cpp +++ b/examples/dummyresource/resourcefactory.cpp @@ -37,6 +37,7 @@ #include "indexupdater.h" #include "adaptorfactoryregistry.h" #include "synchronizer.h" +#include "mailpreprocessor.h" #include "remoteidmap.h" #include #include @@ -131,7 +132,7 @@ DummyResource::DummyResource(const QByteArray &instanceIdentifier, const QShared setupSynchronizer(QSharedPointer::create(PLUGIN_NAME, instanceIdentifier)); setupChangereplay(QSharedPointer::create(instanceIdentifier)); setupPreprocessors(ENTITY_TYPE_MAIL, - QVector() << new DefaultIndexUpdater); + QVector() << new MailPropertyExtractor << new DefaultIndexUpdater); setupPreprocessors(ENTITY_TYPE_FOLDER, QVector() << new DefaultIndexUpdater); setupPreprocessors(ENTITY_TYPE_EVENT, diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0d45f3a..294cce2 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -46,6 +46,7 @@ auto_tests ( inspectiontest accountstest testaccounttest + dummyresourcemailtest ) generate_flatbuffers(dummyresourcetest calendar) target_link_libraries(dummyresourcetest sink_resource_dummy) diff --git a/tests/dummyresourcemailtest.cpp b/tests/dummyresourcemailtest.cpp new file mode 100644 index 0000000..2de2902 --- /dev/null +++ b/tests/dummyresourcemailtest.cpp @@ -0,0 +1,29 @@ +#include + +#include + +#include "common/test.h" +#include "common/domain/applicationdomaintype.h" + +using namespace Sink; +using namespace Sink::ApplicationDomain; + +class DummyMailTest : public Sink::MailTest +{ + Q_OBJECT + +protected: + void resetTestEnvironment() Q_DECL_OVERRIDE + { + } + + Sink::ApplicationDomain::SinkResource createResource() Q_DECL_OVERRIDE + { + auto resource = ApplicationDomain::DummyResource::create("account1"); + return resource; + } +}; + +QTEST_MAIN(DummyMailTest) + +#include "dummyresourcemailtest.moc" -- cgit v1.2.3