Commit 1c7df5df authored by Laurent Montel's avatar Laurent Montel 😁

Add autotests

parent 13a33b77
macro(add_kmail_editorplugin_unittest _source _additional)
set( _test ${_source} ${_additional})
get_filename_component(_name ${_source} NAME_WE)
add_executable( ${_name} ${_test} )
add_test(NAME ${_name} COMMAND ${_name} )
ecm_mark_as_test(kmail_editorplugin-${_name})
target_link_libraries( ${_name} Qt5::Test KF5::XmlGui KF5::IconThemes KF5::MessageComposer KF5::I18n KF5::AkonadiContact)
endmacro ()
add_kmail_editorplugin_unittest(insertshorturlplugineditortest.cpp
"../insertshorturlplugineditor.cpp;../insertshorturlplugineditorinterface.cpp")
add_kmail_editorplugin_unittest(insertshorturlplugineditorinterfacetest.cpp "../insertshorturlplugineditorinterface.cpp")
/*
Copyright (C) 2017 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "insertshorturlplugineditorinterfacetest.h"
#include "../insertshorturlplugineditorinterface.h"
#include <KActionCollection>
#include <QTest>
InsertShorturlPluginEditorInterfaceTest::InsertShorturlPluginEditorInterfaceTest(QObject *parent)
: QObject(parent)
{
}
InsertShorturlPluginEditorInterfaceTest::~InsertShorturlPluginEditorInterfaceTest()
{
}
void InsertShorturlPluginEditorInterfaceTest::shouldHaveDefaultValue()
{
InsertShorturlPluginEditorInterface interface(nullptr);
interface.createAction(new KActionCollection(this));
MessageComposer::ActionType type = interface.actionType();
QVERIFY(type.action());
QCOMPARE(type.type(), MessageComposer::ActionType::Edit);
}
QTEST_MAIN(InsertShorturlPluginEditorInterfaceTest)
/*
Copyright (C) 2017 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef InsertShorturlPLUGINEDITORINTERFACETEST_H
#define InsertShorturlPLUGINEDITORINTERFACETEST_H
#include <QObject>
class InsertShorturlPluginEditorInterfaceTest : public QObject
{
Q_OBJECT
public:
explicit InsertShorturlPluginEditorInterfaceTest(QObject *parent = nullptr);
~InsertShorturlPluginEditorInterfaceTest();
private Q_SLOTS:
void shouldHaveDefaultValue();
};
#endif
/*
Copyright (C) 2017 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "insertshorturlplugineditortest.h"
#include "../insertshorturlplugineditor.h"
#include <KActionCollection>
#include <QTest>
InsertShorturlPluginEditorTest::InsertShorturlPluginEditorTest(QObject *parent)
: QObject(parent)
{
}
InsertShorturlPluginEditorTest::~InsertShorturlPluginEditorTest()
{
}
void InsertShorturlPluginEditorTest::shouldHaveDefaultValue()
{
InsertShorturlPluginEditor plugin;
QVERIFY(plugin.createInterface(new KActionCollection(this)));
QVERIFY(!plugin.hasConfigureDialog());
QVERIFY(!plugin.hasPopupMenuSupport());
QVERIFY(!plugin.hasToolBarSupport());
}
QTEST_MAIN(InsertShorturlPluginEditorTest)
/*
Copyright (C) 2017 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef InsertShorturlPLUGINEDITORTEST_H
#define InsertShorturlPLUGINEDITORTEST_H
#include <QObject>
class InsertShorturlPluginEditorTest : public QObject
{
Q_OBJECT
public:
explicit InsertShorturlPluginEditorTest(QObject *parent = nullptr);
~InsertShorturlPluginEditorTest();
private Q_SLOTS:
void shouldHaveDefaultValue();
};
#endif
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