aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vrátil <dvratil@kde.org>2016-03-31 16:09:09 (GMT)
committerDaniel Vrátil <dvratil@kde.org>2016-08-15 20:03:14 (GMT)
commitd5655c6a80692a39d285b9b085d91dec89af31d5 (patch)
tree284888f68b45f3e9d7ab8d14acdd828b46f22fbb
parent77fd01428eef6e2fddb20ff7410932230e70a35e (diff)
Add an inter-resource move case to NotificationManagerTest
-rw-r--r--autotests/server/notificationmanagertest.cpp119
1 files changed, 69 insertions, 50 deletions
diff --git a/autotests/server/notificationmanagertest.cpp b/autotests/server/notificationmanagertest.cpp
index dc5a5c9..a61689c 100644
--- a/autotests/server/notificationmanagertest.cpp
+++ b/autotests/server/notificationmanagertest.cpp
@@ -236,6 +236,25 @@ private Q_SLOTS:
<< Protocol::ChangeNotification(itemMsg)
<< false;
+ itemMsg = Protocol::ItemChangeNotification();
+ itemMsg.setOperation(Protocol::ItemChangeNotification::Move);
+ itemMsg.setResource("akonadi_resource_0");
+ itemMsg.setDestinationResource("akonadi_resource_0");
+ itemMsg.setParentCollection(1);
+ itemMsg.setParentDestCollection(2);
+ itemMsg.setSessionId("kmail");
+ itemMsg.addItem(10, QStringLiteral("123"), QStringLiteral("1"), QStringLiteral("message/rfc822"));
+ itemMsg.addItem(11, QStringLiteral("456"), QStringLiteral("1"), QStringLiteral("message/rfc822"));
+ QTest::newRow("intra-resource move, owning resource")
+ << false
+ << EmptyList(Entity::Id)
+ << EmptyList(Entity::Id)
+ << List(QByteArray, "akonadi_imap_resource_0")
+ << List(QString, QStringLiteral("message/rfc822"))
+ << List(QByteArray, "akonadi_imap_resource_0")
+ << Protocol::ChangeNotification(itemMsg)
+ << true;
+
colMsg = Protocol::CollectionChangeNotification();
colMsg.setOperation(Protocol::CollectionChangeNotification::Add);
colMsg.setSessionId("kmail");
@@ -267,56 +286,56 @@ private Q_SLOTS:
<< Protocol::ChangeNotification(itemMsg)
<< true;
- Protocol::TagChangeNotification tagMsg;
- tagMsg.setOperation(Protocol::TagChangeNotification::Remove);
- tagMsg.setSessionId("randomSession");
- tagMsg.setResource("akonadi_random_resource_0");
- tagMsg.setId(1);
- tagMsg.setRemoteId(QStringLiteral("TAG"));
- QTest::newRow("Tag removal - resource notification - matching resource source")
- << false
- << EmptyList(Entity::Id)
- << EmptyList(Entity::Id)
- << EmptyList(QByteArray)
- << EmptyList(QString)
- << List(QByteArray, "akonadi_random_resource_0")
- << Protocol::ChangeNotification(tagMsg)
- << true;
-
- QTest::newRow("Tag removal - resource notification - wrong resource source")
- << false
- << EmptyList(Entity::Id)
- << EmptyList(Entity::Id)
- << EmptyList(QByteArray)
- << EmptyList(QString)
- << List(QByteArray, "akonadi_another_resource_1")
- << Protocol::ChangeNotification(tagMsg)
- << false;
-
- tagMsg = Protocol::TagChangeNotification();
- tagMsg.setOperation(Protocol::TagChangeNotification::Remove);
- tagMsg.setSessionId("randomSession");
- tagMsg.setId(1);
- tagMsg.setRemoteId(QStringLiteral("TAG"));
- QTest::newRow("Tag removal - client notification - client source")
- << false
- << EmptyList(Entity::Id)
- << EmptyList(Entity::Id)
- << EmptyList(QByteArray)
- << EmptyList(QString)
- << EmptyList(QByteArray)
- << Protocol::ChangeNotification(tagMsg)
- << true;
-
- QTest::newRow("Tag removal - client notification - resource source")
- << false
- << EmptyList(Entity::Id)
- << EmptyList(Entity::Id)
- << EmptyList(QByteArray)
- << EmptyList(QString)
- << List( QByteArray, "akonadi_some_resource_0" )
- << Protocol::ChangeNotification(tagMsg)
- << false;
+ Protocol::TagChangeNotification tagMsg;
+ tagMsg.setOperation(Protocol::TagChangeNotification::Remove);
+ tagMsg.setSessionId("randomSession");
+ tagMsg.setResource("akonadi_random_resource_0");
+ tagMsg.setId(1);
+ tagMsg.setRemoteId(QStringLiteral("TAG"));
+ QTest::newRow("Tag removal - resource notification - matching resource source")
+ << false
+ << EmptyList(Entity::Id)
+ << EmptyList(Entity::Id)
+ << EmptyList(QByteArray)
+ << EmptyList(QString)
+ << List(QByteArray, "akonadi_random_resource_0")
+ << Protocol::ChangeNotification(tagMsg)
+ << true;
+
+ QTest::newRow("Tag removal - resource notification - wrong resource source")
+ << false
+ << EmptyList(Entity::Id)
+ << EmptyList(Entity::Id)
+ << EmptyList(QByteArray)
+ << EmptyList(QString)
+ << List(QByteArray, "akonadi_another_resource_1")
+ << Protocol::ChangeNotification(tagMsg)
+ << false;
+
+ tagMsg = Protocol::TagChangeNotification();
+ tagMsg.setOperation(Protocol::TagChangeNotification::Remove);
+ tagMsg.setSessionId("randomSession");
+ tagMsg.setId(1);
+ tagMsg.setRemoteId(QStringLiteral("TAG"));
+ QTest::newRow("Tag removal - client notification - client source")
+ << false
+ << EmptyList(Entity::Id)
+ << EmptyList(Entity::Id)
+ << EmptyList(QByteArray)
+ << EmptyList(QString)
+ << EmptyList(QByteArray)
+ << Protocol::ChangeNotification(tagMsg)
+ << true;
+
+ QTest::newRow("Tag removal - client notification - resource source")
+ << false
+ << EmptyList(Entity::Id)
+ << EmptyList(Entity::Id)
+ << EmptyList(QByteArray)
+ << EmptyList(QString)
+ << List( QByteArray, "akonadi_some_resource_0" )
+ << Protocol::ChangeNotification(tagMsg)
+ << false;
}
void testSourceFilter()