Commit d936cdbe authored by Laurent Montel's avatar Laurent Montel 😁

Verify clone attribute

parent aaf5f1a6
......@@ -58,4 +58,16 @@ void CollectionAnnotationsAttributeTest::shouldDeserializedAttribute()
QVERIFY(attr == result);
}
void CollectionAnnotationsAttributeTest::shouldCloneAttribute()
{
QMap<QByteArray, QByteArray> annotations;
annotations.insert("foo", "foo");
annotations.insert("bla", "bla");
annotations.insert("foo2", "bli");
MailCommon::CollectionAnnotationsAttribute attr(annotations);
MailCommon::CollectionAnnotationsAttribute *result = static_cast<MailCommon::CollectionAnnotationsAttribute *>(attr.clone());
QVERIFY(attr == *result);
delete result;
}
QTEST_KDEMAIN(CollectionAnnotationsAttributeTest, NoGUI)
......@@ -31,6 +31,7 @@ private Q_SLOTS:
void shouldHaveDefaultValue();
void shouldAssignAttribute();
void shouldDeserializedAttribute();
void shouldCloneAttribute();
};
#endif // COLLECTIONANNOTATIONSATTRIBUTETEST_H
......@@ -58,4 +58,13 @@ void NewMailNotifierAttributeTest::shouldSerializedData()
QVERIFY(attr == result);
}
void NewMailNotifierAttributeTest::shouldCloneAttribute()
{
MailCommon::NewMailNotifierAttribute attr;
attr.setIgnoreNewMail(true);
MailCommon::NewMailNotifierAttribute *result = attr.clone();
QVERIFY(attr == *result);
delete result;
}
QTEST_KDEMAIN(NewMailNotifierAttributeTest, NoGUI)
......@@ -31,6 +31,7 @@ private Q_SLOTS:
void shouldHaveDefaultValue();
void shouldSetIgnoreNotification();
void shouldSerializedData();
void shouldCloneAttribute();
};
#endif // NEWMAILNOTIFIERATTRIBUTETEST_H
......@@ -50,7 +50,7 @@ QByteArray CollectionAnnotationsAttribute::type() const
return sType;
}
Akonadi::Attribute *CollectionAnnotationsAttribute::clone() const
CollectionAnnotationsAttribute *CollectionAnnotationsAttribute::clone() const
{
return new CollectionAnnotationsAttribute( mAnnotations );
}
......
......@@ -36,7 +36,7 @@ public:
QMap<QByteArray, QByteArray> annotations() const;
QByteArray type() const;
Attribute *clone() const;
CollectionAnnotationsAttribute *clone() const;
QByteArray serialized() const;
void deserialize( const QByteArray &data );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment