• 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
searchrulenumericaltest.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 "searchrulenumericaltest.h"
19 #include "../searchrule/searchrulenumerical.h"
20 #include <qtest_kde.h>
21 SearchRuleNumericalTest::SearchRuleNumericalTest(QObject *parent)
22  : QObject(parent)
23 {
24 
25 }
26 
27 void SearchRuleNumericalTest::shouldHaveDefaultValue()
28 {
29  MailCommon::SearchRuleNumerical ruleStatus;
30  QVERIFY(ruleStatus.contents().isEmpty());
31  QVERIFY(ruleStatus.field().isEmpty());
32  QCOMPARE(ruleStatus.function(), MailCommon::SearchRule::FuncContains);
33  QVERIFY(ruleStatus.isEmpty());
34 }
35 
36 void SearchRuleNumericalTest::shouldBeEmpty()
37 {
38  MailCommon::SearchRuleNumerical ruleStatus(QByteArray(), MailCommon::SearchRule::FuncContains, QLatin1String("foo"));
39  QVERIFY(ruleStatus.isEmpty());
40  ruleStatus =MailCommon::SearchRuleNumerical(QByteArray(), MailCommon::SearchRule::FuncContains, QLatin1String("0"));
41  QVERIFY(!ruleStatus.isEmpty());
42 }
43 
44 void SearchRuleNumericalTest::shouldHaveRequirePart()
45 {
46  MailCommon::SearchRuleNumerical ruleStatus;
47  QCOMPARE(ruleStatus.requiredPart(), MailCommon::SearchRule::Envelope);
48 }
49 
50 void SearchRuleNumericalTest::shouldMatchNumericalsize_data()
51 {
52 #if 0
53  QTest::addColumn<MailCommon::SearchRule::Function>("function");
54  QTest::addColumn<long>("value");
55  QTest::addColumn<long>("matchvalue");
56  QTest::addColumn<bool>("match");
57 #endif
58 }
59 
60 void SearchRuleNumericalTest::shouldMatchNumericalsize()
61 {
62 #if 0
63  QFETCH(MailCommon::SearchRule::Function, function);
64  QFETCH(long, value);
65  QFETCH(long, matchvalue);
66  QFETCH(bool, match);
67  MailCommon::SearchRuleNumerical searchrule("<size>", function, QString::number(value));
68  KMime::Message::Ptr msgPtr = KMime::Message::Ptr(new KMime::Message());
69  msgPtr->date(true)->setDateTime(KDateTime(maildate));
70  Akonadi::Item item;
71  item.setPayload<KMime::Message::Ptr>(msgPtr);
72  QCOMPARE(searchrule.matches(item), match);
73 #endif
74 }
75 
76 
77 QTEST_KDEMAIN(SearchRuleNumericalTest, GUI)
SearchRuleNumericalTest
Definition: searchrulenumericaltest.h:23
QByteArray
MailCommon::SearchRuleNumerical::requiredPart
virtual RequiredPart requiredPart() const
Returns the required part from the item that is needed for the search to operate. ...
Definition: searchrulenumerical.cpp:87
MailCommon::SearchRuleNumerical
This class represents a search pattern rule operating on numerical values.
Definition: searchrulenumerical.h:30
QByteArray::isEmpty
bool isEmpty() const
MailCommon::SearchRuleNumerical::isEmpty
virtual bool isEmpty() const
Determines whether the rule is worth considering.
Definition: searchrulenumerical.cpp:48
searchrulenumericaltest.h
QString::number
QString number(int n, int base)
MailCommon::SearchRule::Function
Function
Describes operators for comparison of field and contents.
Definition: searchrule.h:55
QObject
MailCommon::SearchRule::contents
QString contents() const
Returns the contents of the rule.
Definition: searchrule.cpp:511
QString::isEmpty
bool isEmpty() const
MailCommon::SearchRule::field
QByteArray field() const
Returns the message header field name (without the trailing ':').
Definition: searchrule.cpp:501
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
QLatin1String
SearchRuleNumericalTest::SearchRuleNumericalTest
SearchRuleNumericalTest(QObject *parent=0)
Definition: searchrulenumericaltest.cpp:21
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