Commit 069e5e13 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add autotest

parent e469be71
Pipeline #83151 canceled with stage
......@@ -45,3 +45,8 @@ ecm_add_test(pop3resourceattributetest.cpp
LINK_LIBRARIES KF5::AkonadiMime KF5::AkonadiCore Qt::Test
TEST_NAME pop3resourceattributetest
)
ecm_add_test(addressattributetest.cpp
LINK_LIBRARIES KF5::AkonadiMime KF5::AkonadiCore Qt::Test
TEST_NAME addressattributetest
)
/*
SPDX-FileCopyrightText: 2021 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);
}
/*
SPDX-FileCopyrightText: 2021 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#pragma once
#include <QObject>
class AddressAttributeTest : public QObject
{
Q_OBJECT
public:
explicit AddressAttributeTest(QObject *parent = nullptr);
~AddressAttributeTest() override = default;
private Q_SLOTS:
void shouldHaveDefaultValues();
void shouldDeserializeValues();
};
Supports Markdown
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