diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-24 11:10:07 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-24 11:10:07 +0200 |
commit | 3e443520eaa3559c9f74134007f407b569f22443 (patch) | |
tree | 58ae2b52b6481e58ba376d2972d16efd0cbbfba1 /examples | |
parent | b23948efa2484ac1a37afdb0d077296f6c7f7e0f (diff) | |
download | sink-3e443520eaa3559c9f74134007f407b569f22443.tar.gz sink-3e443520eaa3559c9f74134007f407b569f22443.zip |
Adapt mailtest for the maildirresource
Diffstat (limited to 'examples')
-rw-r--r-- | examples/maildirresource/CMakeLists.txt | 1 | ||||
-rw-r--r-- | examples/maildirresource/tests/CMakeLists.txt | 11 | ||||
-rw-r--r-- | examples/maildirresource/tests/maildirmailtest.cpp | 45 |
3 files changed, 57 insertions, 0 deletions
diff --git a/examples/maildirresource/CMakeLists.txt b/examples/maildirresource/CMakeLists.txt index efaa266..e5bfdb6 100644 --- a/examples/maildirresource/CMakeLists.txt +++ b/examples/maildirresource/CMakeLists.txt | |||
@@ -13,3 +13,4 @@ target_link_libraries(${PROJECT_NAME} sink maildir KF5::Mime) | |||
13 | install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${SINK_RESOURCE_PLUGINS_PATH}) | 13 | install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${SINK_RESOURCE_PLUGINS_PATH}) |
14 | 14 | ||
15 | add_subdirectory(libmaildir) | 15 | add_subdirectory(libmaildir) |
16 | add_subdirectory(tests) | ||
diff --git a/examples/maildirresource/tests/CMakeLists.txt b/examples/maildirresource/tests/CMakeLists.txt new file mode 100644 index 0000000..ffe9286 --- /dev/null +++ b/examples/maildirresource/tests/CMakeLists.txt | |||
@@ -0,0 +1,11 @@ | |||
1 | set(CMAKE_AUTOMOC ON) | ||
2 | include_directories( | ||
3 | ${CMAKE_CURRENT_BINARY_DIR} | ||
4 | ) | ||
5 | |||
6 | include(SinkTest) | ||
7 | |||
8 | auto_tests ( | ||
9 | maildirmailtest | ||
10 | ) | ||
11 | target_link_libraries(maildirmailtest sink_resource_maildir) | ||
diff --git a/examples/maildirresource/tests/maildirmailtest.cpp b/examples/maildirresource/tests/maildirmailtest.cpp new file mode 100644 index 0000000..caaf552 --- /dev/null +++ b/examples/maildirresource/tests/maildirmailtest.cpp | |||
@@ -0,0 +1,45 @@ | |||
1 | #include <QtTest> | ||
2 | |||
3 | #include <tests/mailtest.h> | ||
4 | #include "../maildirresource.h" | ||
5 | |||
6 | #include "common/test.h" | ||
7 | #include "common/domain/applicationdomaintype.h" | ||
8 | |||
9 | using namespace Sink; | ||
10 | using namespace Sink::ApplicationDomain; | ||
11 | |||
12 | /** | ||
13 | * Test of complete system using the maildir resource. | ||
14 | * | ||
15 | * This test requires the maildir resource installed. | ||
16 | */ | ||
17 | class MaildirMailTest : public Sink::MailTest | ||
18 | { | ||
19 | Q_OBJECT | ||
20 | |||
21 | QTemporaryDir tempDir; | ||
22 | QString targetPath; | ||
23 | |||
24 | protected: | ||
25 | void resetTestEnvironment() Q_DECL_OVERRIDE | ||
26 | { | ||
27 | targetPath = tempDir.path() + "/maildir1/"; | ||
28 | } | ||
29 | |||
30 | Sink::ApplicationDomain::SinkResource createResource() Q_DECL_OVERRIDE | ||
31 | { | ||
32 | auto resource = ApplicationDomain::MaildirResource::create("account1"); | ||
33 | resource.setProperty("path", targetPath); | ||
34 | return resource; | ||
35 | } | ||
36 | |||
37 | void removeResourceFromDisk(const QByteArray &identifier) Q_DECL_OVERRIDE | ||
38 | { | ||
39 | ::MaildirResource::removeFromDisk(identifier); | ||
40 | } | ||
41 | }; | ||
42 | |||
43 | QTEST_MAIN(MaildirMailTest) | ||
44 | |||
45 | #include "maildirmailtest.moc" | ||