Commit 4d6521e2 authored by Laurent Montel's avatar Laurent Montel 😁

Add unittest for MessageDisplayFormatAttribute

parent 056c73be
......@@ -41,6 +41,7 @@ kde4_handle_crypto_rpath_for_executable( unencryptedmessagetest )
add_messageviewer_unittest( todoedittest.cpp )
add_messageviewer_unittest( eventedittest.cpp )
add_messageviewer_unittest( eventdatetimewidgettest.cpp )
add_messageviewer_unittest( messagedisplayformatattributetest.cpp )
########### viewertest_gui ###############
......
/*
Copyright (c) 2014 Montel Laurent <montel@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "messagedisplayformatattributetest.h"
#include "../viewer/messagedisplayformatattribute.h"
#include <qtest_kde.h>
MessageDisplayFormatAttributeTest::MessageDisplayFormatAttributeTest(QObject *parent)
: QObject(parent)
{
}
MessageDisplayFormatAttributeTest::~MessageDisplayFormatAttributeTest()
{
}
void MessageDisplayFormatAttributeTest::shouldHaveDefaultValue()
{
MessageViewer::MessageDisplayFormatAttribute attr;
QVERIFY(!attr.remoteContent());
QCOMPARE(attr.messageFormat(), MessageViewer::Viewer::UseGlobalSetting);
}
void MessageDisplayFormatAttributeTest::shouldChangeRemoteValue()
{
MessageViewer::MessageDisplayFormatAttribute attr;
attr.setRemoteContent(true);
QVERIFY(attr.remoteContent());
}
void MessageDisplayFormatAttributeTest::shouldChangeMessageFormat()
{
MessageViewer::Viewer::DisplayFormatMessage format = MessageViewer::Viewer::Html;
MessageViewer::MessageDisplayFormatAttribute attr;
attr.setMessageFormat(format);
QCOMPARE(attr.messageFormat(), format);
format = MessageViewer::Viewer::Text;
attr.setMessageFormat(format);
QCOMPARE(attr.messageFormat(), format);
format = MessageViewer::Viewer::UseGlobalSetting;
attr.setMessageFormat(format);
QCOMPARE(attr.messageFormat(), format);
}
QTEST_KDEMAIN(MessageDisplayFormatAttributeTest, NoGUI)
/*
Copyright (c) 2014 Montel Laurent <montel@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef MESSAGEDISPLAYFORMATATTRIBUTETEST_H
#define MESSAGEDISPLAYFORMATATTRIBUTETEST_H
#include <QObject>
class MessageDisplayFormatAttributeTest : public QObject
{
Q_OBJECT
public:
explicit MessageDisplayFormatAttributeTest(QObject *parent = 0);
~MessageDisplayFormatAttributeTest();
private Q_SLOTS:
void shouldHaveDefaultValue();
void shouldChangeRemoteValue();
void shouldChangeMessageFormat();
};
#endif // MESSAGEDISPLAYFORMATATTRIBUTETEST_H
......@@ -22,11 +22,12 @@
#define MESSAGEDISPLAYFORMATATTRIBUTE_H
#include <akonadi/attribute.h>
#include "messageviewer_export.h"
#include "viewer/viewer.h"
namespace MessageViewer {
class MessageDisplayFormatAttributePrivate;
class MessageDisplayFormatAttribute : public Akonadi::Attribute
class MESSAGEVIEWER_EXPORT MessageDisplayFormatAttribute : public Akonadi::Attribute
{
public:
explicit MessageDisplayFormatAttribute();
......
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