Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 7147dc52 authored by Laurent Montel's avatar Laurent Montel 😁

increase unittest

parent 7831570c
......@@ -124,6 +124,11 @@ MDNStateAttribute::MDNSentState MDNStateAttribute::mdnState() const
return d->dataToState( d->mSentState );
}
bool MDNStateAttribute::operator==(const MDNStateAttribute &other) const
{
return mdnState() == other.mdnState();
}
// Register the attribute when the library is loaded.
namespace {
......
......@@ -106,7 +106,9 @@ public:
* Returns the MDN state.
*/
MDNStateAttribute::MDNSentState mdnState() const;
bool operator==(const MDNStateAttribute &other) const;
private:
//@cond PRIVATE
class Private;
......
......@@ -41,4 +41,26 @@ void MDNStateAttributeTest::shouldHaveType()
QCOMPARE(attr.type(), QByteArray("MDNStateAttribute"));
}
void MDNStateAttributeTest::shouldSerializedAttribute()
{
MessageCore::MDNStateAttribute attr;
attr.setMDNState(MessageCore::MDNStateAttribute::MDNDenied);
QCOMPARE(attr.mdnState(), MessageCore::MDNStateAttribute::MDNDenied);
const QByteArray ba = attr.serialized();
MessageCore::MDNStateAttribute result;
result.deserialize(ba);
QVERIFY(attr == result);
}
void MDNStateAttributeTest::shouldCloneAttribute()
{
MessageCore::MDNStateAttribute attr;
attr.setMDNState(MessageCore::MDNStateAttribute::MDNDenied);
MessageCore::MDNStateAttribute *result = attr.clone();
QVERIFY(attr == *result);
delete result;
}
QTEST_KDEMAIN(MDNStateAttributeTest, NoGUI)
......@@ -29,6 +29,8 @@ public:
private Q_SLOTS:
void shouldHaveDefaultValue();
void shouldHaveType();
void shouldSerializedAttribute();
void shouldCloneAttribute();
};
#endif // MDNSTATEATTRIBUTETEST_H
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