qtest_akonadi.h

00001 /* This file is based on qtest_kde.h from kdelibs
00002     Copyright (C) 2006 David Faure <faure@kde.org>
00003     Copyright (C) 2009 Volker Krause <vkrause@kde.org>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License version 2 as published by the Free Software Foundation.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to
00016     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017     Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef QTEST_AKONADI_H
00021 #define QTEST_AKONADI_H
00022 
00023 #include <qtest_kde.h>
00024 
00039 #define QTEST_AKONADIMAIN(TestObject, flags) \
00040 int main(int argc, char *argv[]) \
00041 { \
00042   setenv("LC_ALL", "C", 1); \
00043   unsetenv("KDE_COLOR_DEBUG"); \
00044   KAboutData aboutData( QByteArray("qttest"), QByteArray(), ki18n("KDE Test Program"), QByteArray("version") );  \
00045   KDEMainFlags mainFlags = flags;                         \
00046   KComponentData cData(&aboutData); \
00047   QApplication app( argc, argv, (mainFlags & GUI) != 0 ); \
00048   app.setApplicationName( QLatin1String("qttest") ); \
00049   qRegisterMetaType<KUrl>(); /*as done by kapplication*/ \
00050   qRegisterMetaType<KUrl::List>(); \
00051   TestObject tc; \
00052   KGlobal::ref(); /* don't quit qeventloop after closing a mainwindow */ \
00053   return QTest::qExec( &tc, argc, argv ); \
00054 }
00055 
00061 #define AKVERIFYEXEC( job ) \
00062   QVERIFY2( job->exec(), job->errorString().toUtf8().constData() )
00063 
00064 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys