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

Verify clone attribute

parent aaf5f1a6
...@@ -58,4 +58,16 @@ void CollectionAnnotationsAttributeTest::shouldDeserializedAttribute() ...@@ -58,4 +58,16 @@ void CollectionAnnotationsAttributeTest::shouldDeserializedAttribute()
QVERIFY(attr == result); 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) QTEST_KDEMAIN(CollectionAnnotationsAttributeTest, NoGUI)
...@@ -31,6 +31,7 @@ private Q_SLOTS: ...@@ -31,6 +31,7 @@ private Q_SLOTS:
void shouldHaveDefaultValue(); void shouldHaveDefaultValue();
void shouldAssignAttribute(); void shouldAssignAttribute();
void shouldDeserializedAttribute(); void shouldDeserializedAttribute();
void shouldCloneAttribute();
}; };
#endif // COLLECTIONANNOTATIONSATTRIBUTETEST_H #endif // COLLECTIONANNOTATIONSATTRIBUTETEST_H
...@@ -58,4 +58,13 @@ void NewMailNotifierAttributeTest::shouldSerializedData() ...@@ -58,4 +58,13 @@ void NewMailNotifierAttributeTest::shouldSerializedData()
QVERIFY(attr == result); 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) QTEST_KDEMAIN(NewMailNotifierAttributeTest, NoGUI)
...@@ -31,6 +31,7 @@ private Q_SLOTS: ...@@ -31,6 +31,7 @@ private Q_SLOTS:
void shouldHaveDefaultValue(); void shouldHaveDefaultValue();
void shouldSetIgnoreNotification(); void shouldSetIgnoreNotification();
void shouldSerializedData(); void shouldSerializedData();
void shouldCloneAttribute();
}; };
#endif // NEWMAILNOTIFIERATTRIBUTETEST_H #endif // NEWMAILNOTIFIERATTRIBUTETEST_H
...@@ -50,7 +50,7 @@ QByteArray CollectionAnnotationsAttribute::type() const ...@@ -50,7 +50,7 @@ QByteArray CollectionAnnotationsAttribute::type() const
return sType; return sType;
} }
Akonadi::Attribute *CollectionAnnotationsAttribute::clone() const CollectionAnnotationsAttribute *CollectionAnnotationsAttribute::clone() const
{ {
return new CollectionAnnotationsAttribute( mAnnotations ); return new CollectionAnnotationsAttribute( mAnnotations );
} }
......
...@@ -36,7 +36,7 @@ public: ...@@ -36,7 +36,7 @@ public:
QMap<QByteArray, QByteArray> annotations() const; QMap<QByteArray, QByteArray> annotations() const;
QByteArray type() const; QByteArray type() const;
Attribute *clone() const; CollectionAnnotationsAttribute *clone() const;
QByteArray serialized() const; QByteArray serialized() const;
void deserialize( const QByteArray &data ); 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