Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Akonadi Mime
Commits
069e5e13
Commit
069e5e13
authored
Sep 28, 2021
by
Laurent Montel
😁
Browse files
Add autotest
parent
e469be71
Pipeline
#83151
canceled with stage
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
autotests/CMakeLists.txt
View file @
069e5e13
...
...
@@ -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
)
autotests/addressattributetest.cpp
0 → 100644
View file @
069e5e13
/*
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
);
}
autotests/addressattributetest.h
0 → 100644
View file @
069e5e13
/*
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
();
};
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment