summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-06-14 07:49:15 +0200
committerMontel Laurent <[email protected]>2017-06-14 07:49:15 +0200
commitaaf5a7bc9cb614b39cb919631b54d2dfff36443e (patch)
treebfb2a10bd96e9e46acdf32b2ed0bcf6e6f9c89d1
parent34bfd39a24010cd356912828e3544a13e780afa6 (diff)
Add more autotests
-rw-r--r--templateparser/autotests/CMakeLists.txt1
-rw-r--r--templateparser/autotests/templateparseremailaddressrequesterinterfacewidgettest.cpp45
-rw-r--r--templateparser/autotests/templateparseremailaddressrequesterinterfacewidgettest.h36
-rw-r--r--templateparser/src/templateparseremailaddressrequesterinterfacewidget.cpp1
4 files changed, 83 insertions, 0 deletions
diff --git a/templateparser/autotests/CMakeLists.txt b/templateparser/autotests/CMakeLists.txt
index 21ebf88..bea1d1d 100644
--- a/templateparser/autotests/CMakeLists.txt
+++ b/templateparser/autotests/CMakeLists.txt
@@ -34,3 +34,4 @@ add_templateparser_unittest(templateextracthtmlelementwebengineviewtest.cpp)
add_templateparser_unittest(templateparserjobtest.cpp)
add_templateparser_unittest(templateparserextracthtmlinfotest.cpp)
add_templateparser_unittest(templateparseremailaddressrequesterlineedittest.cpp)
+add_templateparser_unittest(templateparseremailaddressrequesterinterfacewidgettest.cpp)
diff --git a/templateparser/autotests/templateparseremailaddressrequesterinterfacewidgettest.cpp b/templateparser/autotests/templateparseremailaddressrequesterinterfacewidgettest.cpp
new file mode 100644
index 0000000..a161ef1
--- /dev/null
+++ b/templateparser/autotests/templateparseremailaddressrequesterinterfacewidgettest.cpp
@@ -0,0 +1,45 @@
+/*
+ Copyright (C) 2017 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 "templateparseremailaddressrequesterinterfacewidgettest.h"
+#include "../src/templateparseremailaddressrequesterinterfacewidget.h"
+#include <TemplateParser/TemplateParserEmailAddressRequesterBase>
+#include <QHBoxLayout>
+#include <QTest>
+
+TemplateParserEmailAddressRequesterInterfaceWidgetTest::TemplateParserEmailAddressRequesterInterfaceWidgetTest(QObject *parent)
+ : QObject(parent)
+{
+
+}
+
+void TemplateParserEmailAddressRequesterInterfaceWidgetTest::shouldHaveDefaultValues()
+{
+ TemplateParser::TemplateParserEmailAddressRequesterInterfaceWidget w;
+ QHBoxLayout *mainLayout = w.findChild<QHBoxLayout *>(QStringLiteral("mainlayout"));
+ QVERIFY(mainLayout);
+ QCOMPARE(mainLayout->margin(), 0);
+
+ TemplateParser::TemplateParserEmailAddressRequesterBase *mTemplateParserEmailBase =
+ w.findChild<TemplateParser::TemplateParserEmailAddressRequesterBase *>(QStringLiteral("templateparseremailbase"));
+ QVERIFY(mTemplateParserEmailBase);
+ QVERIFY(mTemplateParserEmailBase->text().isEmpty());
+}
+
+QTEST_MAIN(TemplateParserEmailAddressRequesterInterfaceWidgetTest)
diff --git a/templateparser/autotests/templateparseremailaddressrequesterinterfacewidgettest.h b/templateparser/autotests/templateparseremailaddressrequesterinterfacewidgettest.h
new file mode 100644
index 0000000..bc915bd
--- /dev/null
+++ b/templateparser/autotests/templateparseremailaddressrequesterinterfacewidgettest.h
@@ -0,0 +1,36 @@
+/*
+ Copyright (C) 2017 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 TEMPLATEPARSEREMAILADDRESSREQUESTERINTERFACEWIDGETTEST_H
+#define TEMPLATEPARSEREMAILADDRESSREQUESTERINTERFACEWIDGETTEST_H
+
+#include <QObject>
+
+class TemplateParserEmailAddressRequesterInterfaceWidgetTest : public QObject
+{
+ Q_OBJECT
+public:
+ explicit TemplateParserEmailAddressRequesterInterfaceWidgetTest(QObject *parent = nullptr);
+ ~TemplateParserEmailAddressRequesterInterfaceWidgetTest() = default;
+
+private Q_SLOTS:
+ void shouldHaveDefaultValues();
+};
+
+#endif // TEMPLATEPARSEREMAILADDRESSREQUESTERINTERFACEWIDGETTEST_H
diff --git a/templateparser/src/templateparseremailaddressrequesterinterfacewidget.cpp b/templateparser/src/templateparseremailaddressrequesterinterfacewidget.cpp
index e45c17c..a724b8d 100644
--- a/templateparser/src/templateparseremailaddressrequesterinterfacewidget.cpp
+++ b/templateparser/src/templateparseremailaddressrequesterinterfacewidget.cpp
@@ -46,6 +46,7 @@ void TemplateParserEmailAddressRequesterInterfaceWidget::initializeEmailWidget()
} else {
mTemplateParserEmailBase = new TemplateParser::TemplateParserEmailAddressRequesterLineEdit(this);
}
+ mTemplateParserEmailBase->setObjectName(QStringLiteral("templateparseremailbase"));
connect(mTemplateParserEmailBase, &TemplateParserEmailAddressRequesterBase::textChanged,
this, &TemplateParserEmailAddressRequesterInterfaceWidget::textChanged);
}