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

akonadi

  • sources
  • kde-4.12
  • kdepimlibs
  • akonadi
qtest_akonadi.h
1 /* This file is based on qtest_kde.h from kdelibs
2  Copyright (C) 2006 David Faure <faure@kde.org>
3  Copyright (C) 2009 Volker Krause <vkrause@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #ifndef QTEST_AKONADI_H
21 #define QTEST_AKONADI_H
22 
23 #include <qtest_kde.h>
24 
25 #include <akonadi/agentinstance.h>
26 #include <akonadi/agentmanager.h>
27 #include <klocale.h>
28 
43 #define QTEST_AKONADIMAIN(TestObject, flags) \
44 int main(int argc, char *argv[]) \
45 { \
46  setenv( "LC_ALL", "C", 1); \
47  unsetenv( "KDE_COLOR_DEBUG" ); \
48  KAboutData aboutData( QByteArray( "qttest" ), QByteArray(), ki18n( "KDE Test Program" ), QByteArray( "version" ) ); \
49  KDEMainFlags mainFlags = flags; \
50  KComponentData cData(&aboutData); \
51  QApplication app( argc, argv, (mainFlags & GUI) != 0 ); \
52  app.setApplicationName( QLatin1String( "qttest" ) ); \
53  qRegisterMetaType<KUrl>(); /*as done by kapplication*/ \
54  qRegisterMetaType<KUrl::List>(); \
55  TestObject tc; \
56  KGlobal::ref(); /* don't quit qeventloop after closing a mainwindow */ \
57  return QTest::qExec( &tc, argc, argv ); \
58 }
59 
60 namespace AkonadiTest {
64 void checkTestIsIsolated() {
65  Q_ASSERT_X( !qgetenv( "TESTRUNNER_DB_ENVIRONMENT" ).isEmpty(),
66  "AkonadiTest::checkTestIsIsolated",
67  "This test must be run using ctest, in order to use the testrunner environment. Aborting, to avoid messing up your real akonadi" );
68 }
69 
73 void setAllResourcesOffline() {
74  // switch all resources offline to reduce interference from them
75  foreach ( Akonadi::AgentInstance agent, Akonadi::AgentManager::self()->instances() ) //krazy:exclude=foreach
76  agent.setIsOnline( false );
77 }
78 
79 } // namespace
80 
86 #define AKVERIFYEXEC( job ) \
87  QVERIFY2( job->exec(), job->errorString().toUtf8().constData() )
88 
89 #endif
Akonadi::AgentInstance::setIsOnline
void setIsOnline(bool online)
Sets online status of the agent instance.
Definition: agentinstance.cpp:100
Akonadi::AgentManager::self
static AgentManager * self()
Returns the global instance of the agent manager.
Definition: agentmanager.cpp:380
Akonadi::AgentInstance
A representation of an agent instance.
Definition: agentinstance.h:62
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:27 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi

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

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

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