summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Montel <[email protected]>2017-12-26 13:18:14 +0100
committerLaurent Montel <[email protected]>2017-12-26 14:00:47 +0100
commit1c7df5dfc50616a303f8f0adcd597949611c09db (patch)
tree8dc81e0252d24c5cd77ad31ae40f7d0667f00532
parent13a33b770a2730fd926bad9b419bb95abaf2415a (diff)
Add autotests
-rw-r--r--kmail/editorplugins/insertshorturl/autotests/CMakeLists.txt14
-rw-r--r--kmail/editorplugins/insertshorturl/autotests/insertshorturlplugineditorinterfacetest.cpp43
-rw-r--r--kmail/editorplugins/insertshorturl/autotests/insertshorturlplugineditorinterfacetest.h35
-rw-r--r--kmail/editorplugins/insertshorturl/autotests/insertshorturlplugineditortest.cpp43
-rw-r--r--kmail/editorplugins/insertshorturl/autotests/insertshorturlplugineditortest.h35
5 files changed, 170 insertions, 0 deletions
diff --git a/kmail/editorplugins/insertshorturl/autotests/CMakeLists.txt b/kmail/editorplugins/insertshorturl/autotests/CMakeLists.txt
index e69de29..a31a2f9 100644
--- a/kmail/editorplugins/insertshorturl/autotests/CMakeLists.txt
+++ b/kmail/editorplugins/insertshorturl/autotests/CMakeLists.txt
@@ -0,0 +1,14 @@
+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")
diff --git a/kmail/editorplugins/insertshorturl/autotests/insertshorturlplugineditorinterfacetest.cpp b/kmail/editorplugins/insertshorturl/autotests/insertshorturlplugineditorinterfacetest.cpp
new file mode 100644
index 0000000..9f32804
--- /dev/null
+++ b/kmail/editorplugins/insertshorturl/autotests/insertshorturlplugineditorinterfacetest.cpp
@@ -0,0 +1,43 @@
+/*
+ Copyright (C) 2017 Montel Laurent <[email protected]>
+
+ 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)
diff --git a/kmail/editorplugins/insertshorturl/autotests/insertshorturlplugineditorinterfacetest.h b/kmail/editorplugins/insertshorturl/autotests/insertshorturlplugineditorinterfacetest.h
new file mode 100644
index 0000000..1b4f330
--- /dev/null
+++ b/kmail/editorplugins/insertshorturl/autotests/insertshorturlplugineditorinterfacetest.h
@@ -0,0 +1,35 @@
+/*
+ Copyright (C) 2017 Montel Laurent <[email protected]>
+
+ 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
diff --git a/kmail/editorplugins/insertshorturl/autotests/insertshorturlplugineditortest.cpp b/kmail/editorplugins/insertshorturl/autotests/insertshorturlplugineditortest.cpp
new file mode 100644
index 0000000..4e55c79
--- /dev/null
+++ b/kmail/editorplugins/insertshorturl/autotests/insertshorturlplugineditortest.cpp
@@ -0,0 +1,43 @@
+/*
+ Copyright (C) 2017 Montel Laurent <[email protected]>
+
+ 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)
diff --git a/kmail/editorplugins/insertshorturl/autotests/insertshorturlplugineditortest.h b/kmail/editorplugins/insertshorturl/autotests/insertshorturlplugineditortest.h
new file mode 100644
index 0000000..45878a9
--- /dev/null
+++ b/kmail/editorplugins/insertshorturl/autotests/insertshorturlplugineditortest.h
@@ -0,0 +1,35 @@
+/*
+ Copyright (C) 2017 Montel Laurent <[email protected]>
+
+ 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