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

Add autotests

parent b66da798
......@@ -7,4 +7,4 @@ macro(add_regexpeditorplugin_unittest _source _additional)
ecm_mark_as_test(sieveeditorplugin-${_name})
target_link_libraries( ${_name} Qt5::Widgets Qt5::Test KF5::I18n KF5::KSieveUi)
endmacro ()
add_regexpeditorplugin_unittest(regexpeditorlineedittest.cpp "")
add_regexpeditorplugin_unittest(regexpeditorlineedittest.cpp "../regexpeditorlineedit.cpp")
......@@ -18,6 +18,9 @@
*/
#include "regexpeditorlineedittest.h"
#include "../regexpeditorlineedit.h"
#include <QLineEdit>
#include <QPushButton>
#include <QTest>
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)
......@@ -28,6 +28,9 @@ class RegexpEditorLineEditTest : public QObject
public:
explicit RegexpEditorLineEditTest(QObject *parent = nullptr);
~RegexpEditorLineEditTest() = default;
private Q_SLOTS:
void shouldHaveDefaultValue();
};
#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