Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KPimTextEdit
Commits
a913f881
Commit
a913f881
authored
Feb 25, 2022
by
Laurent Montel
😁
Browse files
Add autotest
parent
db839ed9
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/texteditor/commonwidget/autotests/CMakeLists.txt
View file @
a913f881
...
...
@@ -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
)
src/texteditor/commonwidget/autotests/textfindwidgettest.cpp
0 → 100644
View file @
a913f881
/*
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
());
}
src/texteditor/commonwidget/autotests/textfindwidgettest.h
0 → 100644
View file @
a913f881
/*
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
();
};
src/texteditor/commonwidget/autotests/textreplacewidgettest.cpp
0 → 100644
View file @
a913f881
/*
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
());
}
src/texteditor/commonwidget/autotests/textreplacewidgettest.h
0 → 100644
View file @
a913f881
/*
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
();
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment