summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Montel <[email protected]>2018-02-05 07:35:32 +0100
committerLaurent Montel <[email protected]>2018-02-05 07:35:32 +0100
commit0c52dc2938d2e633944b746e5f0bab7f6d83d337 (patch)
tree8db427e2db3ef3a146b4820a54792293b6964246
parent51fb6e9a5e64e526a8cf33af1a96f534583d96ae (diff)
Fix connect signal/slot. Add autotest
-rw-r--r--templateparser/autotests/CMakeLists.txt1
-rw-r--r--templateparser/autotests/templatesinsertcommandactiontest.cpp28
-rw-r--r--templateparser/autotests/templatesinsertcommandactiontest.h33
-rw-r--r--templateparser/src/templatesinsertcommandaction.cpp7
-rw-r--r--templateparser/src/templatesinsertcommandaction.h3
5 files changed, 65 insertions, 7 deletions
diff --git a/templateparser/autotests/CMakeLists.txt b/templateparser/autotests/CMakeLists.txt
index b9db421..c2f4f0e 100644
--- a/templateparser/autotests/CMakeLists.txt
+++ b/templateparser/autotests/CMakeLists.txt
@@ -35,3 +35,4 @@ add_templateparser_unittest(templateparserjobtest.cpp)
add_templateparser_unittest(templateparserextracthtmlinfotest.cpp)
add_templateparser_unittest(templateparseremailaddressrequesterlineedittest.cpp)
add_templateparser_unittest(templateparseremailaddressrequesterinterfacewidgettest.cpp)
+add_templateparser_unittest(templatesinsertcommandactiontest.cpp)
diff --git a/templateparser/autotests/templatesinsertcommandactiontest.cpp b/templateparser/autotests/templatesinsertcommandactiontest.cpp
new file mode 100644
index 0000000..2547a2c
--- /dev/null
+++ b/templateparser/autotests/templatesinsertcommandactiontest.cpp
@@ -0,0 +1,28 @@
+/*
+ Copyright (C) 2018 Laurent Montel <[email protected]>
+
+ 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 "templatesinsertcommandactiontest.h"
+#include <QTest>
+QTEST_MAIN(TemplatesInsertCommandActionTest)
+
+TemplatesInsertCommandActionTest::TemplatesInsertCommandActionTest(QObject *parent)
+ : QObject(parent)
+{
+
+}
diff --git a/templateparser/autotests/templatesinsertcommandactiontest.h b/templateparser/autotests/templatesinsertcommandactiontest.h
new file mode 100644
index 0000000..b5d2a10
--- /dev/null
+++ b/templateparser/autotests/templatesinsertcommandactiontest.h
@@ -0,0 +1,33 @@
+/*
+ Copyright (C) 2018 Laurent Montel <[email protected]>
+
+ 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 TEMPLATESINSERTCOMMANDACTIONTEST_H
+#define TEMPLATESINSERTCOMMANDACTIONTEST_H
+
+#include <QObject>
+
+class TemplatesInsertCommandActionTest : public QObject
+{
+ Q_OBJECT
+public:
+ explicit TemplatesInsertCommandActionTest(QObject *parent = nullptr);
+ ~TemplatesInsertCommandActionTest() = default;
+};
+
+#endif // TEMPLATESINSERTCOMMANDACTIONTEST_H
diff --git a/templateparser/src/templatesinsertcommandaction.cpp b/templateparser/src/templatesinsertcommandaction.cpp
index 7ee5acb..d64a711 100644
--- a/templateparser/src/templatesinsertcommandaction.cpp
+++ b/templateparser/src/templatesinsertcommandaction.cpp
@@ -27,7 +27,7 @@ TemplatesInsertCommandAction::TemplatesInsertCommandAction(QObject *parent)
{
mMenuCommand = new TemplatesCommandMenu(this);
mMenuCommand->setObjectName(QStringLiteral("templatescommandmenu"));
- //connect(mMenuCommand, &TemplatesCommandMenu::insertCommand, this, &TemplatesInsertCommandAction::slotInsertCommand);
+ connect(mMenuCommand, QOverload<const QString &, int>::of(&TemplatesCommandMenu::insertCommand), this, &TemplatesInsertCommandAction::insertCommand);
setMenu(mMenuCommand->menu());
}
@@ -36,8 +36,3 @@ TemplatesInsertCommandAction::~TemplatesInsertCommandAction()
{
}
-
-void TemplatesInsertCommandAction::slotInsertCommand(const QString &cmd, int adjustCursor)
-{
- //TODO
-}
diff --git a/templateparser/src/templatesinsertcommandaction.h b/templateparser/src/templatesinsertcommandaction.h
index 10f0a83..6d4e7cd 100644
--- a/templateparser/src/templatesinsertcommandaction.h
+++ b/templateparser/src/templatesinsertcommandaction.h
@@ -33,9 +33,10 @@ class TEMPLATEPARSER_EXPORT TemplatesInsertCommandAction : public QAction
public:
explicit TemplatesInsertCommandAction(QObject *parent = nullptr);
~TemplatesInsertCommandAction();
+Q_SIGNALS:
+ void insertCommand(const QString &cmd, int adjustCursor);
private:
TemplatesCommandMenu *mMenuCommand = nullptr;
- void slotInsertCommand(const QString &cmd, int adjustCursor);
};
}