• 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
searchpatterntest.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2015 Tomas Trnka <tomastrnka@gmx.com>
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 "searchpatterntest.h"
19 #include "../searchpattern.h"
20 #include <qtest_kde.h>
21 
22 SearchPatternTest::SearchPatternTest(QObject *parent)
23  : QObject(parent)
24 {
25 
26 }
27 
28 SearchPatternTest::~SearchPatternTest()
29 {
30 
31 }
32 
33 void SearchPatternTest::shouldRuleRequirePart_data()
34 {
35  QTest::addColumn<QByteArray>( "field" );
36  QTest::addColumn<MailCommon::SearchRule::RequiredPart>( "part" );
37 
38  // SearchRuleStatus
39  QTest::newRow( "status" ) << QByteArray( "<status>" ) << MailCommon::SearchRule::Envelope;
40 
41  // SearchRuleNumerical
42  QTest::newRow( "numerical" ) << QByteArray( "<size>" ) << MailCommon::SearchRule::Envelope;
43 
44  // SearchRuleDate
45  QTest::newRow( "date" ) << QByteArray( "<date>" ) << MailCommon::SearchRule::Envelope;
46 
47  // SearchRuleString
48  QTest::newRow( "recipients" ) << QByteArray( "<recipients>" ) << MailCommon::SearchRule::Envelope;
49  QTest::newRow( "tag" ) << QByteArray( "<tag>" ) << MailCommon::SearchRule::Envelope;
50  QTest::newRow( "subject" ) << QByteArray( "subject" ) << MailCommon::SearchRule::Envelope;
51  QTest::newRow( "from" ) << QByteArray( "from" ) << MailCommon::SearchRule::Envelope;
52  QTest::newRow( "sender" ) << QByteArray( "sender" ) << MailCommon::SearchRule::Envelope;
53  QTest::newRow( "reply-to" ) << QByteArray( "reply-to" ) << MailCommon::SearchRule::Envelope;
54  QTest::newRow( "to" ) << QByteArray( "to" ) << MailCommon::SearchRule::Envelope;
55  QTest::newRow( "cc" ) << QByteArray( "cc" ) << MailCommon::SearchRule::Envelope;
56  QTest::newRow( "bcc" ) << QByteArray( "bcc" ) << 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( "any header" ) << QByteArray( "<any header>" ) << MailCommon::SearchRule::Header;
62  QTest::newRow( "custom header" ) << QByteArray( "X-DummyHeaderName" ) << MailCommon::SearchRule::Header;
63  QTest::newRow( "Organization" ) << QByteArray( "Organization" ) << MailCommon::SearchRule::Header;
64  QTest::newRow( "List-Id" ) << QByteArray( "List-Id" ) << MailCommon::SearchRule::Header;
65  QTest::newRow( "Resent-From" ) << QByteArray( "Resent-From" ) << MailCommon::SearchRule::Header;
66  QTest::newRow( "X-Loop" ) << QByteArray( "X-Loop" ) << MailCommon::SearchRule::Header;
67  QTest::newRow( "X-Mailing-List" ) << QByteArray( "X-Mailing-List" ) << MailCommon::SearchRule::Header;
68  QTest::newRow( "X-Spam-Flag" ) << QByteArray( "X-Spam-Flag" ) << MailCommon::SearchRule::Header;
69 
70  QTest::newRow( "<message>" ) << QByteArray( "<message>" ) << MailCommon::SearchRule::CompleteMessage;
71  QTest::newRow( "<body>" ) << QByteArray( "<body>" ) << MailCommon::SearchRule::CompleteMessage;
72 }
73 
74 void SearchPatternTest::shouldRuleRequirePart()
75 {
76  QFETCH( QByteArray, field );
77  QFETCH( MailCommon::SearchRule::RequiredPart, part );
78 
79  const MailCommon::SearchRule::Ptr rule = MailCommon::SearchRule::createInstance( field, MailCommon::SearchRule::FuncNone, QString() );
80 
81  QCOMPARE( rule->requiredPart(), part );
82 }
83 
84 QTEST_KDEMAIN(SearchPatternTest, NoGUI)
SearchPatternTest::SearchPatternTest
SearchPatternTest(QObject *parent=0)
Definition: searchpatterntest.cpp:22
QByteArray
MailCommon::SearchRule::Ptr
boost::shared_ptr< SearchRule > Ptr
Defines a pointer to a search rule.
Definition: searchrule.h:44
MailCommon::SearchRule::CompleteMessage
Definition: searchrule.h:82
QObject
MailCommon::SearchRule::FuncNone
Definition: searchrule.h:56
MailCommon::SearchRule::RequiredPart
RequiredPart
Definition: searchrule.h:79
QString
MailCommon::SearchRule::Envelope
Definition: searchrule.h:80
searchpatterntest.h
QTest::newRow
QTestData & newRow(const char *dataTag)
SearchPatternTest
Definition: searchpatterntest.h:23
MailCommon::SearchRule::createInstance
static SearchRule::Ptr createInstance(const QByteArray &field=0, Function function=FuncContains, const QString &contents=QString())
Creates a new search rule of a certain type by instantiating the appropriate subclass depending on th...
Definition: searchrule.cpp:91
MailCommon::SearchRule::Header
Definition: searchrule.h:81
SearchPatternTest::~SearchPatternTest
~SearchPatternTest()
Definition: searchpatterntest.cpp:28
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:31:40 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