diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-07-07 22:23:49 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-07-07 22:23:49 +0200 |
commit | da2b049e248c1ad7efeb53685158a205335e4e36 (patch) | |
tree | 1e7e5e940e9b760b2108081b1d2f3879cebdb0ff /tests | |
parent | 9bcb822963fc96c94dbe7dcc4134dcd2dac454ff (diff) | |
download | sink-da2b049e248c1ad7efeb53685158a205335e4e36.tar.gz sink-da2b049e248c1ad7efeb53685158a205335e4e36.zip |
A new debug system.
Instead of a single #define as debug area the new system allows for an
identifier for each debug message with the structure component.area.
The component is a dot separated identifier of the runtime component,
such as the process or the plugin.
The area is the code component, and can be as such defined at
compiletime.
The idea of this system is that it becomes possible to i.e. look at the
output of all messages in the query subsystem of a specific resource
(something that happens in the client process, but in the
resource-specific subcomponent).
The new macros are supposed to be less likely to clash with other names,
hence the new names.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/clientapitest.cpp | 10 | ||||
-rw-r--r-- | tests/mailsynctest.cpp | 4 | ||||
-rw-r--r-- | tests/mailtest.cpp | 6 | ||||
-rw-r--r-- | tests/messagequeuetest.cpp | 4 |
4 files changed, 16 insertions, 8 deletions
diff --git a/tests/clientapitest.cpp b/tests/clientapitest.cpp index 8c5866d..ec74cbd 100644 --- a/tests/clientapitest.cpp +++ b/tests/clientapitest.cpp | |||
@@ -9,6 +9,8 @@ | |||
9 | #include "resultprovider.h" | 9 | #include "resultprovider.h" |
10 | #include "facadefactory.h" | 10 | #include "facadefactory.h" |
11 | 11 | ||
12 | SINK_DEBUG_AREA("clientapitest") | ||
13 | |||
12 | template <typename T> | 14 | template <typename T> |
13 | class TestDummyResourceFacade : public Sink::StoreFacade<T> | 15 | class TestDummyResourceFacade : public Sink::StoreFacade<T> |
14 | { | 16 | { |
@@ -44,7 +46,7 @@ public: | |||
44 | { | 46 | { |
45 | auto resultProvider = new Sink::ResultProvider<typename T::Ptr>(); | 47 | auto resultProvider = new Sink::ResultProvider<typename T::Ptr>(); |
46 | resultProvider->onDone([resultProvider]() { | 48 | resultProvider->onDone([resultProvider]() { |
47 | Trace() << "Result provider is done"; | 49 | SinkTrace() << "Result provider is done"; |
48 | delete resultProvider; | 50 | delete resultProvider; |
49 | }); | 51 | }); |
50 | // We have to do it this way, otherwise we're not setting the fetcher right | 52 | // We have to do it this way, otherwise we're not setting the fetcher right |
@@ -52,11 +54,11 @@ public: | |||
52 | 54 | ||
53 | resultProvider->setFetcher([query, resultProvider, this](const typename T::Ptr &parent) { | 55 | resultProvider->setFetcher([query, resultProvider, this](const typename T::Ptr &parent) { |
54 | if (parent) { | 56 | if (parent) { |
55 | Trace() << "Running the fetcher " << parent->identifier(); | 57 | SinkTrace() << "Running the fetcher " << parent->identifier(); |
56 | } else { | 58 | } else { |
57 | Trace() << "Running the fetcher."; | 59 | SinkTrace() << "Running the fetcher."; |
58 | } | 60 | } |
59 | Trace() << "-------------------------."; | 61 | SinkTrace() << "-------------------------."; |
60 | for (const auto &res : results) { | 62 | for (const auto &res : results) { |
61 | qDebug() << "Parent filter " << query.propertyFilter.value("parent").value.toByteArray() << res->identifier() << res->getProperty("parent").toByteArray(); | 63 | qDebug() << "Parent filter " << query.propertyFilter.value("parent").value.toByteArray() << res->identifier() << res->getProperty("parent").toByteArray(); |
62 | auto parentProperty = res->getProperty("parent").toByteArray(); | 64 | auto parentProperty = res->getProperty("parent").toByteArray(); |
diff --git a/tests/mailsynctest.cpp b/tests/mailsynctest.cpp index 953adbf..4401f27 100644 --- a/tests/mailsynctest.cpp +++ b/tests/mailsynctest.cpp | |||
@@ -31,6 +31,8 @@ | |||
31 | using namespace Sink; | 31 | using namespace Sink; |
32 | using namespace Sink::ApplicationDomain; | 32 | using namespace Sink::ApplicationDomain; |
33 | 33 | ||
34 | SINK_DEBUG_AREA("mailsynctest") | ||
35 | |||
34 | void MailSyncTest::initTestCase() | 36 | void MailSyncTest::initTestCase() |
35 | { | 37 | { |
36 | Test::initTest(); | 38 | Test::initTest(); |
@@ -73,7 +75,7 @@ void MailSyncTest::testListFolders() | |||
73 | for (const auto &folder : folders) { | 75 | for (const auto &folder : folders) { |
74 | names << folder->getName(); | 76 | names << folder->getName(); |
75 | } | 77 | } |
76 | Trace() << "base folder: " << names; | 78 | SinkTrace() << "base folder: " << names; |
77 | baseCount = folders.size(); | 79 | baseCount = folders.size(); |
78 | }); | 80 | }); |
79 | VERIFYEXEC(job); | 81 | VERIFYEXEC(job); |
diff --git a/tests/mailtest.cpp b/tests/mailtest.cpp index 8031cf1..0537175 100644 --- a/tests/mailtest.cpp +++ b/tests/mailtest.cpp | |||
@@ -31,6 +31,8 @@ | |||
31 | using namespace Sink; | 31 | using namespace Sink; |
32 | using namespace Sink::ApplicationDomain; | 32 | using namespace Sink::ApplicationDomain; |
33 | 33 | ||
34 | SINK_DEBUG_AREA("mailtest") | ||
35 | |||
34 | void MailTest::initTestCase() | 36 | void MailTest::initTestCase() |
35 | { | 37 | { |
36 | Test::initTest(); | 38 | Test::initTest(); |
@@ -251,7 +253,7 @@ void MailTest::testMoveMail() | |||
251 | auto mail = *mails.first(); | 253 | auto mail = *mails.first(); |
252 | modifiedMail = mail; | 254 | modifiedMail = mail; |
253 | QCOMPARE(mail.getFolder(), folder.identifier()); | 255 | QCOMPARE(mail.getFolder(), folder.identifier()); |
254 | Warning() << "path: " << mail.getMimeMessagePath(); | 256 | SinkWarning() << "path: " << mail.getMimeMessagePath(); |
255 | QVERIFY(QFile(mail.getMimeMessagePath()).exists()); | 257 | QVERIFY(QFile(mail.getMimeMessagePath()).exists()); |
256 | }); | 258 | }); |
257 | VERIFYEXEC(job); | 259 | VERIFYEXEC(job); |
@@ -270,7 +272,7 @@ void MailTest::testMoveMail() | |||
270 | auto mail = *mails.first(); | 272 | auto mail = *mails.first(); |
271 | QCOMPARE(mail.getFolder(), folder1.identifier()); | 273 | QCOMPARE(mail.getFolder(), folder1.identifier()); |
272 | QVERIFY(QFile(mail.getMimeMessagePath()).exists()); | 274 | QVERIFY(QFile(mail.getMimeMessagePath()).exists()); |
273 | Trace() << "Mime message path: " << mail.getMimeMessagePath(); | 275 | SinkTrace() << "Mime message path: " << mail.getMimeMessagePath(); |
274 | }); | 276 | }); |
275 | VERIFYEXEC(job); | 277 | VERIFYEXEC(job); |
276 | } | 278 | } |
diff --git a/tests/messagequeuetest.cpp b/tests/messagequeuetest.cpp index 484ff86..a8d0d4d 100644 --- a/tests/messagequeuetest.cpp +++ b/tests/messagequeuetest.cpp | |||
@@ -8,6 +8,8 @@ | |||
8 | #include "messagequeue.h" | 8 | #include "messagequeue.h" |
9 | #include "log.h" | 9 | #include "log.h" |
10 | 10 | ||
11 | SINK_DEBUG_AREA("messagequeuetest") | ||
12 | |||
11 | /** | 13 | /** |
12 | * Test of the messagequeue implementation. | 14 | * Test of the messagequeue implementation. |
13 | */ | 15 | */ |
@@ -80,7 +82,7 @@ private slots: | |||
80 | } | 82 | } |
81 | 83 | ||
82 | while (!queue.isEmpty()) { | 84 | while (!queue.isEmpty()) { |
83 | Log() << "start"; | 85 | SinkLog() << "start"; |
84 | const auto expected = values.dequeue(); | 86 | const auto expected = values.dequeue(); |
85 | bool gotValue = false; | 87 | bool gotValue = false; |
86 | bool gotError = false; | 88 | bool gotError = false; |