Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Kalendar
Commits
abdcc06b
Commit
abdcc06b
authored
Oct 16, 2022
by
Claudio Cambra
Browse files
Add test for filter
Signed-off-by:
Claudio Cambra
<
claudio.cambra@kde.org
>
parent
c8527c16
Pipeline
#248926
passed with stage
in 3 minutes and 55 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
autotests/CMakeLists.txt
View file @
abdcc06b
...
...
@@ -25,6 +25,11 @@ set (commonAkonadiTest_LIBS
KF5::EventViews
)
set
(
filterTest_SRCS
filtertest.cpp
../src/filter.cpp
)
set
(
incidenceOccurrenceModelTest_SRCS
incidenceoccurrencemodeltest.cpp
../src/models/incidenceoccurrencemodel.cpp
...
...
@@ -39,6 +44,11 @@ set(todoSortFilterProxyModelTest_SRCS
ecm_qt_declare_logging_category
(
incidenceOccurrenceModelTest_SRCS HEADER kalendar_debug.h IDENTIFIER KALENDAR_LOG CATEGORY_NAME org.kde.kalendar DESCRIPTION
"kalendar"
EXPORT KALENDAR
)
add_executable
(
filtertest
${
filterTest_SRCS
}
)
add_test
(
NAME filtertest COMMAND filtertest
)
ecm_mark_as_test
(
filtertest
)
target_link_libraries
(
filtertest
${
commonAkonadiTest_LIBS
}
)
# the tests need the ical resource, which we might not have at this point (e.g. on the CI)
find_program
(
AKONADI_ICAL_RESOURCE NAMES akonadi_ical_resource
)
if
(
UNIX
)
...
...
autotests/filtertest.cpp
0 → 100644
View file @
abdcc06b
// SPDX-FileCopyrightText: 2022 Claudio Cambra <claudio.cambra@gmail.com>
// SPDX-License-Identifier: LGPL-2.0-or-later
#include
"../src/filter.h"
#include
<QTest>
#include
<QSignalSpy>
class
FilterTest
:
public
QObject
{
Q_OBJECT
public:
FilterTest
()
=
default
;
~
FilterTest
()
override
=
default
;
private:
static
constexpr
qint64
m_testCollectionId
=
1
;
const
QString
m_testName
=
QStringLiteral
(
"name"
);
const
QStringList
m_testTags
{
QStringLiteral
(
"tag-1"
),
QStringLiteral
(
"tag-2"
),
QStringLiteral
(
"tag-3"
)};
private
Q_SLOTS
:
void
initTestCase
()
{
}
void
testProperties
()
{
Filter
filter
;
QSignalSpy
collectionIdChanged
(
&
filter
,
&
Filter
::
collectionIdChanged
);
QSignalSpy
tagsChanged
(
&
filter
,
&
Filter
::
tagsChanged
);
QSignalSpy
nameChanged
(
&
filter
,
&
Filter
::
nameChanged
);
filter
.
setCollectionId
(
m_testCollectionId
);
QCOMPARE
(
collectionIdChanged
.
count
(),
1
);
QCOMPARE
(
filter
.
collectionId
(),
m_testCollectionId
);
filter
.
setTags
(
m_testTags
);
QCOMPARE
(
tagsChanged
.
count
(),
1
);
QCOMPARE
(
filter
.
tags
(),
m_testTags
);
filter
.
setName
(
m_testName
);
QCOMPARE
(
nameChanged
.
count
(),
1
);
QCOMPARE
(
filter
.
name
(),
m_testName
);
}
};
QTEST_MAIN
(
FilterTest
)
#include
"filtertest.moc"
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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