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

akonadi

  • 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 
42 #define QTEST_AKONADIMAIN(TestObject, flags) \
43 int main(int argc, char *argv[]) \
44 { \
45  setenv( "LC_ALL", "C", 1); \
46  unsetenv( "KDE_COLOR_DEBUG" ); \
47  KAboutData aboutData( QByteArray( "qttest" ), QByteArray(), ki18n( "KDE Test Program" ), QByteArray( "version" ) ); \
48  KDEMainFlags mainFlags = flags; \
49  KComponentData cData(&aboutData); \
50  QApplication app( argc, argv, (mainFlags & GUI) != 0 ); \
51  app.setApplicationName( QLatin1String( "qttest" ) ); \
52  qRegisterMetaType<KUrl>(); /*as done by kapplication*/ \
53  qRegisterMetaType<KUrl::List>(); \
54  TestObject tc; \
55  KGlobal::ref(); /* don't quit qeventloop after closing a mainwindow */ \
56  return QTest::qExec( &tc, argc, argv ); \
57 }
58 
59 namespace AkonadiTest {
63 void checkTestIsIsolated() {
64  QVERIFY2( !qgetenv( "TESTRUNNER_DB_ENVIRONMENT" ).isEmpty(),
65  "This test must be run using ctest, in order to use the testrunner environment. Aborting, to avoid messing up your real akonadi" );
66 }
67 
71 void setAllResourcesOffline() {
72  // switch all resources offline to reduce interference from them
73  foreach ( Akonadi::AgentInstance agent, Akonadi::AgentManager::self()->instances() ) //krazy:exclude=foreach
74  agent.setIsOnline( false );
75 }
76 
77 } // namespace
78 
84 #define AKVERIFYEXEC( job ) \
85  QVERIFY2( job->exec(), job->errorString().toUtf8().constData() )
86 
87 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jul 13 2013 01:27:40 by doxygen 1.8.3.1 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-4.10.5 API Reference

Skip menu "kdepimlibs-4.10.5 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
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