• 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
  • filter
  • autotests
filteractionwithaddresstest.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 #include "filteractionwithaddresstest.h"
18 #include "../filteractions/filteractionwithaddress.h"
19 #include <qtest_kde.h>
20 #include <QWidget>
21 #include <widgets/emailaddressrequester.h>
22 
23 class TestFilterActionWithAddress : public MailCommon::FilterActionWithAddress
24 {
25 public:
26  TestFilterActionWithAddress()
27  : MailCommon::FilterActionWithAddress(QLatin1String("foo"), QLatin1String("bla"))
28  {
29 
30  }
31  FilterAction::ReturnCode process(MailCommon::ItemContext &context , bool) const
32  {
33  return GoOn;
34  }
35 
36  MailCommon::SearchRule::RequiredPart requiredPart() const
37  {
38  return MailCommon::SearchRule::CompleteMessage;
39  }
40 
41 
42 };
43 
44 FilterActionWithAddressTest::FilterActionWithAddressTest(QObject *parent)
45  : QObject(parent)
46 {
47 
48 }
49 
50 FilterActionWithAddressTest::~FilterActionWithAddressTest()
51 {
52 
53 }
54 
55 void FilterActionWithAddressTest::shouldHaveDefaultValue()
56 {
57  TestFilterActionWithAddress filter;
58  QWidget *w = filter.createParamWidget(0);
59  QCOMPARE(w->objectName(), QLatin1String("emailaddressrequester"));
60  MessageCore::EmailAddressRequester *requester = dynamic_cast<MessageCore::EmailAddressRequester *>(w);
61  QVERIFY(requester);
62  QVERIFY(filter.isEmpty());
63 }
64 
65 void FilterActionWithAddressTest::shouldAssignValue()
66 {
67  TestFilterActionWithAddress filter;
68  QWidget *w = filter.createParamWidget(0);
69  MessageCore::EmailAddressRequester *requester = dynamic_cast<MessageCore::EmailAddressRequester *>(w);
70  filter.argsFromString(QLatin1String("foo"));
71  filter.setParamWidgetValue(w);
72  QVERIFY(!filter.isEmpty());
73  QVERIFY(!requester->text().isEmpty());
74 }
75 
76 void FilterActionWithAddressTest::shouldRequiresPart()
77 {
78  TestFilterActionWithAddress filter;
79  QCOMPARE(filter.requiredPart(), MailCommon::SearchRule::CompleteMessage);
80 }
81 
82 QTEST_KDEMAIN(FilterActionWithAddressTest, GUI)
QWidget
MailCommon::FilterAction::GoOn
Go on with applying filter actions.
Definition: filteraction.h:62
filteractionwithaddresstest.h
FilterActionWithAddressTest::~FilterActionWithAddressTest
~FilterActionWithAddressTest()
Definition: filteractionwithaddresstest.cpp:50
MailCommon::FilterAction::requiredPart
virtual SearchRule::RequiredPart requiredPart() const =0
Returns the required part from the item that is needed for the action to operate. ...
MailCommon::SearchRule::CompleteMessage
Definition: searchrule.h:82
FilterActionWithAddressTest::FilterActionWithAddressTest
FilterActionWithAddressTest(QObject *parent=0)
Definition: filteractionwithaddresstest.cpp:44
QObject
QObject::objectName
objectName
MailCommon::SearchRule::RequiredPart
RequiredPart
Definition: searchrule.h:79
FilterActionWithAddressTest
Definition: filteractionwithaddresstest.h:23
QLatin1String
MailCommon::FilterAction::process
virtual ReturnCode process(ItemContext &context, bool applyOnOutbound) const =0
Execute action on given message (inside the item context).
context
const char * context
Definition: searchpatternedit.cpp:54
MailCommon::FilterActionWithAddress
Abstract base class for filter actions with a mail address as parameter.
Definition: filteractionwithaddress.h:42
MailCommon::ItemContext
A helper class for the filtering process.
Definition: itemcontext.h:39
MailCommon::FilterActionWithAddress::FilterActionWithAddress
FilterActionWithAddress(const QString &name, const QString &label, QObject *parent=0)
Creates a new filter action.
Definition: filteractionwithaddress.cpp:26
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