Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Unmaintained
KDE Pim
Commits
3cf8bc91
Commit
3cf8bc91
authored
Dec 08, 2014
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unittest
parent
dcb61049
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
126 additions
and
0 deletions
+126
-0
kmail/tests/CMakeLists.txt
kmail/tests/CMakeLists.txt
+5
-0
kmail/tests/cryptostateindicatorwidgettest.cpp
kmail/tests/cryptostateindicatorwidgettest.cpp
+86
-0
kmail/tests/cryptostateindicatorwidgettest.h
kmail/tests/cryptostateindicatorwidgettest.h
+35
-0
No files found.
kmail/tests/CMakeLists.txt
View file @
3cf8bc91
...
...
@@ -37,3 +37,8 @@ set( kmail_createfollowupreminderonexistingmessagejobtest_source createfollowupr
kde4_add_unit_test
(
createfollowupreminderonexistingmessagejobtest
${
kmail_createfollowupreminderonexistingmessagejobtest_source
}
)
target_link_libraries
(
createfollowupreminderonexistingmessagejobtest
${
QT_QTTEST_LIBRARY
}
${
KDE4_KDEUI_LIBS
}
${
KDEPIMLIBS_AKONADI_LIBS
}
${
KDEPIMLIBS_KCALCORE_LIBS
}
followupreminder
)
set
(
kmail_cryptostateindicatorwidgettest_source cryptostateindicatorwidgettest.cpp ../editor/cryptostateindicatorwidget.cpp
)
kde4_add_unit_test
(
cryptostateindicatorwidgettest
${
kmail_cryptostateindicatorwidgettest_source
}
)
target_link_libraries
(
cryptostateindicatorwidgettest
${
QT_QTTEST_LIBRARY
}
${
KDE4_KDEUI_LIBS
}
messagecore
)
kmail/tests/cryptostateindicatorwidgettest.cpp
0 → 100644
View file @
3cf8bc91
/*
Copyright (c) 2014 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "cryptostateindicatorwidgettest.h"
#include "editor/cryptostateindicatorwidget.h"
#include <qtest_kde.h>
#include <QLabel>
CryptoStateIndicatorWidgetTest
::
CryptoStateIndicatorWidgetTest
(
QObject
*
parent
)
:
QObject
(
parent
)
{
}
CryptoStateIndicatorWidgetTest
::~
CryptoStateIndicatorWidgetTest
()
{
}
void
CryptoStateIndicatorWidgetTest
::
shouldHaveDefaultValue
()
{
CryptoStateIndicatorWidget
w
;
w
.
show
();
QTest
::
qWaitForWindowShown
(
&
w
);
QLabel
*
signature
=
qFindChild
<
QLabel
*>
(
&
w
,
QLatin1String
(
"signatureindicator"
));
QVERIFY
(
signature
);
QLabel
*
encryption
=
qFindChild
<
QLabel
*>
(
&
w
,
QLatin1String
(
"encryptionindicator"
));
QVERIFY
(
encryption
);
QVERIFY
(
signature
->
isVisible
());
QVERIFY
(
encryption
->
isVisible
());
}
void
CryptoStateIndicatorWidgetTest
::
shouldBeNotVisibleWhenShowAlwaysIsFalse
()
{
CryptoStateIndicatorWidget
w
;
w
.
setShowAlwaysIndicator
(
false
);
w
.
show
();
QTest
::
qWaitForWindowShown
(
&
w
);
QLabel
*
signature
=
qFindChild
<
QLabel
*>
(
&
w
,
QLatin1String
(
"signatureindicator"
));
QLabel
*
encryption
=
qFindChild
<
QLabel
*>
(
&
w
,
QLatin1String
(
"encryptionindicator"
));
QVERIFY
(
!
signature
->
isVisible
());
QVERIFY
(
!
encryption
->
isVisible
());
w
.
updateSignatureAndEncrypionStateIndicators
(
true
,
true
);
QVERIFY
(
!
signature
->
isVisible
());
QVERIFY
(
!
encryption
->
isVisible
());
}
void
CryptoStateIndicatorWidgetTest
::
shouldVisibleWhenChangeStatus
()
{
CryptoStateIndicatorWidget
w
;
w
.
setShowAlwaysIndicator
(
true
);
w
.
show
();
QTest
::
qWaitForWindowShown
(
&
w
);
QLabel
*
signature
=
qFindChild
<
QLabel
*>
(
&
w
,
QLatin1String
(
"signatureindicator"
));
QLabel
*
encryption
=
qFindChild
<
QLabel
*>
(
&
w
,
QLatin1String
(
"encryptionindicator"
));
w
.
updateSignatureAndEncrypionStateIndicators
(
true
,
false
);
QVERIFY
(
signature
->
isVisible
());
QVERIFY
(
!
encryption
->
isVisible
());
w
.
updateSignatureAndEncrypionStateIndicators
(
false
,
true
);
QVERIFY
(
!
signature
->
isVisible
());
QVERIFY
(
encryption
->
isVisible
());
w
.
updateSignatureAndEncrypionStateIndicators
(
true
,
true
);
QVERIFY
(
signature
->
isVisible
());
QVERIFY
(
encryption
->
isVisible
());
w
.
updateSignatureAndEncrypionStateIndicators
(
false
,
false
);
QVERIFY
(
!
signature
->
isVisible
());
QVERIFY
(
!
encryption
->
isVisible
());
}
QTEST_KDEMAIN
(
CryptoStateIndicatorWidgetTest
,
GUI
)
kmail/tests/cryptostateindicatorwidgettest.h
0 → 100644
View file @
3cf8bc91
/*
Copyright (c) 2014 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef CRYPTOSTATEINDICATORWIDGETTEST_H
#define CRYPTOSTATEINDICATORWIDGETTEST_H
#include <QObject>
class
CryptoStateIndicatorWidgetTest
:
public
QObject
{
Q_OBJECT
public:
explicit
CryptoStateIndicatorWidgetTest
(
QObject
*
parent
=
0
);
~
CryptoStateIndicatorWidgetTest
();
private
Q_SLOTS
:
void
shouldHaveDefaultValue
();
void
shouldBeNotVisibleWhenShowAlwaysIsFalse
();
void
shouldVisibleWhenChangeStatus
();
};
#endif // CRYPTOSTATEINDICATORWIDGETTEST_H
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