Commit b1441ca6 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add autotest

parent 6eeda226
......@@ -11,3 +11,4 @@ endmacro ()
add_kmail_checkbeforedeleting_unittest(confirmbeforedeletingdialogtest.cpp)
add_kmail_checkbeforedeleting_unittest(confirmbeforedeletingwidgettest.cpp)
add_kmail_checkbeforedeleting_unittest(confirmbeforedeletingruletest.cpp)
add_kmail_checkbeforedeleting_unittest(confirmbeforedeletingcreaterulewidgettest.cpp)
/*
SPDX-FileCopyrightText: 2021 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "confirmbeforedeletingcreaterulewidgettest.h"
#include "confirmbeforedeletingcreaterulewidget.h"
#include <QComboBox>
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QTest>
QTEST_MAIN(ConfirmBeforeDeletingCreateRuleWidgetTest)
ConfirmBeforeDeletingCreateRuleWidgetTest::ConfirmBeforeDeletingCreateRuleWidgetTest(QObject *parent)
: QObject(parent)
{
}
void ConfirmBeforeDeletingCreateRuleWidgetTest::shouldHaveDefaultValues()
{
ConfirmBeforeDeletingCreateRuleWidget w;
auto mainLayout = w.findChild<QHBoxLayout *>(QStringLiteral("mainLayout"));
QVERIFY(mainLayout);
auto mPatternLineEdit = w.findChild<QLineEdit *>(QStringLiteral("mPatternLineEdit"));
QVERIFY(mPatternLineEdit);
QVERIFY(mPatternLineEdit->text().isEmpty());
auto mRuleTypeComboBox = w.findChild<QComboBox *>(QStringLiteral("mRuleTypeComboBox"));
QVERIFY(mRuleTypeComboBox);
QVERIFY(mRuleTypeComboBox->count() > 0);
auto label = w.findChild<QLabel *>(QStringLiteral("label"));
QVERIFY(!label->text().isEmpty());
}
/*
SPDX-FileCopyrightText: 2021 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#pragma once
#include <QObject>
class ConfirmBeforeDeletingCreateRuleWidgetTest : public QObject
{
Q_OBJECT
public:
explicit ConfirmBeforeDeletingCreateRuleWidgetTest(QObject *parent = nullptr);
~ConfirmBeforeDeletingCreateRuleWidgetTest() override = default;
private Q_SLOTS:
void shouldHaveDefaultValues();
};
......@@ -21,7 +21,7 @@ void ConfirmBeforeDeletingPlugin::showConfigureDialog(QWidget *parent)
{
QPointer<ConfirmBeforeDeletingDialog> dlg = new ConfirmBeforeDeletingDialog(parent);
if (dlg->exec()) {
// TODO
// TODO save element
}
delete dlg;
}
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