Commit 6a1a5a47 authored by Laurent Montel's avatar Laurent Montel 😁

Add autotest

parent 2aa76d39
set(kmail_inserttemplatecommandeditorplugin_SRCS
inserttemplatecommandplugineditor.cpp
inserttemplatecommandplugineditorinterface.cpp
)
kcoreaddons_add_plugin(kmail_inserttemplatecommandeditorplugin JSON kmail_inserttemplatecommandeditorplugin.json SOURCES
${kmail_inserttemplatecommandeditorplugin_SRCS} INSTALL_NAMESPACE kmail)
target_link_libraries(kmail_inserttemplatecommandeditorplugin
KF5::IconThemes KF5::MessageComposer KF5::XmlGui KF5::I18n
)
if(BUILD_TESTING)
add_subdirectory(autotests)
endif()
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)
endmacro ()
add_kmail_editorplugin_unittest(inserttemplatecommandplugineditortest.cpp "../inserttemplatecommandplugineditor.cpp;../inserttemplatecommandplugineditorinterface.cpp")
add_kmail_editorplugin_unittest(inserttemplatecommandplugineditorinterfacetest.cpp "../inserttemplatecommandplugineditorinterface.cpp")
/*
Copyright (C) 2018 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 "inserttemplatecommandplugineditorinterfacetest.h"
#include "../inserttemplatecommandplugineditorinterface.h"
#include <KActionCollection>
#include <QTest>
InsertTemplateCommandPluginEditorInterfaceTest::InsertTemplateCommandPluginEditorInterfaceTest(QObject *parent)
: QObject(parent)
{
}
InsertTemplateCommandPluginEditorInterfaceTest::~InsertTemplateCommandPluginEditorInterfaceTest()
{
}
void InsertTemplateCommandPluginEditorInterfaceTest::shouldHaveDefaultValue()
{
InsertTemplateCommandPluginEditorInterface interface(nullptr);
interface.createAction(new KActionCollection(this));
MessageComposer::ActionType type = interface.actionType();
QVERIFY(type.action());
QCOMPARE(type.type(), MessageComposer::ActionType::Edit);
}
QTEST_MAIN(InsertTemplateCommandPluginEditorInterfaceTest)
/*
Copyright (C) 2018 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 InsertTemplateCommandPLUGINEDITORINTERFACETEST_H
#define InsertTemplateCommandPLUGINEDITORINTERFACETEST_H
#include <QObject>
class InsertTemplateCommandPluginEditorInterfaceTest : public QObject
{
Q_OBJECT
public:
explicit InsertTemplateCommandPluginEditorInterfaceTest(QObject *parent = nullptr);
~InsertTemplateCommandPluginEditorInterfaceTest();
private Q_SLOTS:
void shouldHaveDefaultValue();
};
#endif
/*
Copyright (C) 2018 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 "inserttemplatecommandplugineditortest.h"
#include "../inserttemplatecommandplugineditor.h"
#include <KActionCollection>
#include <QTest>
InsertTemplateCommandPluginEditorTest::InsertTemplateCommandPluginEditorTest(QObject *parent)
: QObject(parent)
{
}
InsertTemplateCommandPluginEditorTest::~InsertTemplateCommandPluginEditorTest()
{
}
void InsertTemplateCommandPluginEditorTest::shouldHaveDefaultValue()
{
InsertTemplateCommandPluginEditor plugin;
QVERIFY(plugin.createInterface(new KActionCollection(this)));
QVERIFY(!plugin.hasConfigureDialog());
QVERIFY(!plugin.hasPopupMenuSupport());
QVERIFY(!plugin.hasToolBarSupport());
}
QTEST_MAIN(InsertTemplateCommandPluginEditorTest)
/*
Copyright (C) 2018 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 InsertTemplateCommandPLUGINEDITORTEST_H
#define InsertTemplateCommandPLUGINEDITORTEST_H
#include <QObject>
class InsertTemplateCommandPluginEditorTest : public QObject
{
Q_OBJECT
public:
explicit InsertTemplateCommandPluginEditorTest(QObject *parent = nullptr);
~InsertTemplateCommandPluginEditorTest();
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