akondi-mime5/akonadi-mime5/autotests/addressattributetest.cpp

38 lines
1.0 KiB
C++
Raw Normal View History

2024-08-05 16:19:50 +02:00
/*
SPDX-FileCopyrightText: 2021-2022 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "addressattributetest.h"
#include "addressattribute.h"
#include <QTest>
QTEST_MAIN(AddressAttributeTest)
AddressAttributeTest::AddressAttributeTest(QObject *parent)
: QObject(parent)
{
}
void AddressAttributeTest::shouldHaveDefaultValues()
{
Akonadi::AddressAttribute attr;
QVERIFY(attr.from().isEmpty());
QVERIFY(attr.to().isEmpty());
QVERIFY(attr.cc().isEmpty());
QVERIFY(attr.bcc().isEmpty());
QVERIFY(!attr.deliveryStatusNotification());
}
void AddressAttributeTest::shouldDeserializeValues()
{
Akonadi::AddressAttribute attr;
attr.setFrom(QStringLiteral("from"));
attr.setTo({QStringLiteral("to")});
attr.setBcc({QStringLiteral("bcc")});
attr.setCc({QStringLiteral("cc")});
attr.setDeliveryStatusNotification(true);
const QByteArray ba = attr.serialized();
Akonadi::AddressAttribute result;
result.deserialize(ba);
QVERIFY(attr == result);
}