• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

mailcommon

  • sources
  • kde-4.14
  • kdepim
  • mailcommon
  • search
  • autotests
searchrulestringtest.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2015 Montel Laurent <montel@kde.org>
3 
4  This program is free software; you can redistribute it and/or modify it
5  under the terms of the GNU General Public License, version 2, as
6  published by the Free Software Foundation.
7 
8  This program is distributed in the hope that it will be useful, but
9  WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License along
14  with this program; if not, write to the Free Software Foundation, Inc.,
15  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #include "searchrulestringtest.h"
19 #include "../searchrule/searchrulestring.h"
20 #include <qtest_kde.h>
21 
22 SearchRuleStringTest::SearchRuleStringTest(QObject *parent)
23  : QObject(parent)
24 {
25 
26 }
27 
28 void SearchRuleStringTest::shouldHaveDefaultValue()
29 {
30  MailCommon::SearchRuleString searchrule;
31  QCOMPARE(searchrule.function(), MailCommon::SearchRule::FuncContains);
32  QVERIFY(searchrule.isEmpty());
33 }
34 
35 void SearchRuleStringTest::shouldHaveRequirePart()
36 {
37  QFETCH(QByteArray, field);
38  QFETCH(MailCommon::SearchRule::RequiredPart, requiredpart);
39  MailCommon::SearchRuleString ruleStatus(field);
40  QCOMPARE(ruleStatus.requiredPart(), requiredpart);
41 }
42 
43 void SearchRuleStringTest::shouldHaveRequirePart_data()
44 {
45  QTest::addColumn<QByteArray>("field");
46  QTest::addColumn<MailCommon::SearchRule::RequiredPart>("requiredpart");
47 
48  QTest::newRow("recipient") << QByteArray("<recipients>") << MailCommon::SearchRule::Envelope;
49  QTest::newRow("status") << QByteArray("<status>") << MailCommon::SearchRule::Envelope;
50  QTest::newRow("tag") << QByteArray("<tag>") << MailCommon::SearchRule::Envelope;
51  QTest::newRow("subject") << QByteArray("subject") << MailCommon::SearchRule::Envelope;
52  QTest::newRow("from") << QByteArray("from") << MailCommon::SearchRule::Envelope;
53  QTest::newRow("sender") << QByteArray("sender") << MailCommon::SearchRule::Envelope;
54  QTest::newRow("reply-to") << QByteArray("reply-to") << MailCommon::SearchRule::Envelope;
55  QTest::newRow("to") << QByteArray("to") << MailCommon::SearchRule::Envelope;
56  QTest::newRow("cc") << QByteArray("cc") << MailCommon::SearchRule::Envelope;
57  QTest::newRow("in-reply-to") << QByteArray("in-reply-to") << MailCommon::SearchRule::Envelope;
58  QTest::newRow("message-id") << QByteArray("message-id") << MailCommon::SearchRule::Envelope;
59  QTest::newRow("references") << QByteArray("references") << MailCommon::SearchRule::Envelope;
60 
61  QTest::newRow("messages") << QByteArray("<message>") << MailCommon::SearchRule::CompleteMessage;
62  QTest::newRow("body") << QByteArray("<body>") << MailCommon::SearchRule::CompleteMessage;
63 
64  QTest::newRow("unknown") << QByteArray("unknown") << MailCommon::SearchRule::Header;
65 }
66 
67 void SearchRuleStringTest::shouldMatchString()
68 {
69 
70 }
71 
72 void SearchRuleStringTest::shouldMatchString_data()
73 {
74 
75 }
76 
77 void SearchRuleStringTest::shouldBeEmpty()
78 {
79  MailCommon::SearchRuleString searchrule;
80  QVERIFY(searchrule.isEmpty());
81  searchrule = MailCommon::SearchRuleString(QByteArray(), MailCommon::SearchRule::FuncContains, QLatin1String("foo"));
82  QVERIFY(searchrule.isEmpty());
83  searchrule = MailCommon::SearchRuleString(QByteArray("<tag>"), MailCommon::SearchRule::FuncContains, QString());
84  QVERIFY(searchrule.isEmpty());
85 
86  searchrule = MailCommon::SearchRuleString(QByteArray("<tag>"), MailCommon::SearchRule::FuncContains, QLatin1String("foo"));
87  QVERIFY(!searchrule.isEmpty());
88 }
89 
90 
91 QTEST_KDEMAIN(SearchRuleStringTest, GUI)
QByteArray
SearchRuleStringTest::SearchRuleStringTest
SearchRuleStringTest(QObject *parent=0)
Definition: searchrulestringtest.cpp:22
SearchRuleStringTest
Definition: searchrulestringtest.h:22
MailCommon::SearchRule::CompleteMessage
Definition: searchrule.h:82
searchrulestringtest.h
QObject
MailCommon::SearchRuleString::isEmpty
virtual bool isEmpty() const
Determines whether the rule is worth considering.
Definition: searchrulestring.cpp:74
MailCommon::SearchRule::RequiredPart
RequiredPart
Definition: searchrule.h:79
QString
MailCommon::SearchRule::Envelope
Definition: searchrule.h:80
MailCommon::SearchRule::FuncContains
Definition: searchrule.h:57
MailCommon::SearchRule::function
Function function() const
Returns the filter function of the rule.
Definition: searchrule.cpp:491
MailCommon::SearchRuleString
Definition: searchrulestring.h:32
QTest::newRow
QTestData & newRow(const char *dataTag)
QLatin1String
MailCommon::SearchRule::Header
Definition: searchrule.h:81
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:31:41 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

mailcommon

Skip menu "mailcommon"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal