Commit 7e3dc77a authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add autotests

parent b66da798
...@@ -7,4 +7,4 @@ macro(add_regexpeditorplugin_unittest _source _additional) ...@@ -7,4 +7,4 @@ macro(add_regexpeditorplugin_unittest _source _additional)
ecm_mark_as_test(sieveeditorplugin-${_name}) ecm_mark_as_test(sieveeditorplugin-${_name})
target_link_libraries( ${_name} Qt5::Widgets Qt5::Test KF5::I18n KF5::KSieveUi) target_link_libraries( ${_name} Qt5::Widgets Qt5::Test KF5::I18n KF5::KSieveUi)
endmacro () endmacro ()
add_regexpeditorplugin_unittest(regexpeditorlineedittest.cpp "") add_regexpeditorplugin_unittest(regexpeditorlineedittest.cpp "../regexpeditorlineedit.cpp")
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
*/ */
#include "regexpeditorlineedittest.h" #include "regexpeditorlineedittest.h"
#include "../regexpeditorlineedit.h"
#include <QLineEdit>
#include <QPushButton>
#include <QTest> #include <QTest>
RegexpEditorLineEditTest::RegexpEditorLineEditTest(QObject *parent) RegexpEditorLineEditTest::RegexpEditorLineEditTest(QObject *parent)
...@@ -26,4 +29,17 @@ RegexpEditorLineEditTest::RegexpEditorLineEditTest(QObject *parent) ...@@ -26,4 +29,17 @@ RegexpEditorLineEditTest::RegexpEditorLineEditTest(QObject *parent)
} }
void RegexpEditorLineEditTest::shouldHaveDefaultValue()
{
RegexpEditorLineEdit w;
QLineEdit *mLineEdit = w.findChild<QLineEdit *>(QStringLiteral("lineedit"));
QVERIFY(mLineEdit);
QVERIFY(mLineEdit->text().isEmpty());
QPushButton *mRegExpEditorButton = w.findChild<QPushButton *>(QStringLiteral("regexpbutton"));
QVERIFY(mRegExpEditorButton);
QVERIFY(!mRegExpEditorButton->text().isEmpty());
QVERIFY(!mRegExpEditorButton->toolTip().isEmpty());
}
QTEST_MAIN(RegexpEditorLineEditTest) QTEST_MAIN(RegexpEditorLineEditTest)
...@@ -28,6 +28,9 @@ class RegexpEditorLineEditTest : public QObject ...@@ -28,6 +28,9 @@ class RegexpEditorLineEditTest : public QObject
public: public:
explicit RegexpEditorLineEditTest(QObject *parent = nullptr); explicit RegexpEditorLineEditTest(QObject *parent = nullptr);
~RegexpEditorLineEditTest() = default; ~RegexpEditorLineEditTest() = default;
private Q_SLOTS:
void shouldHaveDefaultValue();
}; };
#endif // REGEXPEDITORLINEEDITTEST_H #endif // REGEXPEDITORLINEEDITTEST_H
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