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

Add autotest

parent db839ed9
......@@ -4,3 +4,13 @@ ecm_add_tests(textgotolinewidgettest.cpp
NAME_PREFIX "kpimtextedit-plaintext-"
LINK_LIBRARIES KF5::PimTextEdit Qt${QT_MAJOR_VERSION}::Test Qt${QT_MAJOR_VERSION}::Widgets
)
ecm_add_tests(textfindwidgettest.cpp
NAME_PREFIX "kpimtextedit-plaintext-"
LINK_LIBRARIES KF5::PimTextEdit Qt${QT_MAJOR_VERSION}::Test Qt${QT_MAJOR_VERSION}::Widgets
)
ecm_add_tests(textreplacewidgettest.cpp
NAME_PREFIX "kpimtextedit-plaintext-"
LINK_LIBRARIES KF5::PimTextEdit Qt${QT_MAJOR_VERSION}::Test Qt${QT_MAJOR_VERSION}::Widgets
)
/*
SPDX-FileCopyrightText: 2022 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "textfindwidgettest.h"
#include "texteditor/commonwidget/textfindreplacewidget.h"
#include <QPushButton>
#include <QTest>
QTEST_MAIN(TextFindWidgetTest)
TextFindWidgetTest::TextFindWidgetTest(QObject *parent)
: QObject{parent}
{
}
void TextFindWidgetTest::shouldHaveDefaultValues()
{
KPIMTextEdit::TextFindWidget w;
QVERIFY(w.searchLineEdit());
QVERIFY(!w.isRegularExpression());
QVERIFY(w.searchText().isEmpty());
auto mFindNextBtn = w.findChild<QPushButton *>(QStringLiteral("mFindNextBtn"));
QVERIFY(mFindNextBtn);
QVERIFY(!mFindNextBtn->text().isEmpty());
QVERIFY(!mFindNextBtn->toolTip().isEmpty());
QVERIFY(!mFindNextBtn->isEnabled());
auto mFindPrevBtn = w.findChild<QPushButton *>(QStringLiteral("mFindPrevBtn"));
QVERIFY(mFindPrevBtn);
QVERIFY(!mFindPrevBtn->text().isEmpty());
QVERIFY(!mFindPrevBtn->toolTip().isEmpty());
QVERIFY(!mFindPrevBtn->isEnabled());
auto optionsBtn = w.findChild<QPushButton *>(QStringLiteral("optionsBtn"));
QVERIFY(optionsBtn);
QVERIFY(!optionsBtn->text().isEmpty());
QVERIFY(!optionsBtn->toolTip().isEmpty());
QVERIFY(optionsBtn->isEnabled());
}
/*
SPDX-FileCopyrightText: 2022 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#pragma once
#include <QObject>
class TextFindWidgetTest : public QObject
{
Q_OBJECT
public:
explicit TextFindWidgetTest(QObject *parent = nullptr);
~TextFindWidgetTest() override = default;
private Q_SLOTS:
void shouldHaveDefaultValues();
};
/*
SPDX-FileCopyrightText: 2022 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "textreplacewidgettest.h"
#include "texteditor/commonwidget/textfindreplacewidget.h"
#include <QTest>
QTEST_MAIN(TextReplaceWidgetTest)
TextReplaceWidgetTest::TextReplaceWidgetTest(QObject *parent)
: QObject{parent}
{
}
void TextReplaceWidgetTest::shouldHaveDefaultValues()
{
KPIMTextEdit::TextReplaceWidget w;
QVERIFY(w.replaceLineEdit());
}
/*
SPDX-FileCopyrightText: 2022 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#pragma once
#include <QObject>
class TextReplaceWidgetTest : public QObject
{
Q_OBJECT
public:
explicit TextReplaceWidgetTest(QObject *parent = nullptr);
~TextReplaceWidgetTest() override = default;
private Q_SLOTS:
void shouldHaveDefaultValues();
};
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