• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KUnitTest

module.h

Go to the documentation of this file.
00001 
00026 #ifndef KUNITTEST_MODULE_H
00027 #define KUNITTEST_MODULE_H
00028 
00029 #include <QtCore/QString>
00030 
00031 #include <klibloader.h>
00032 #include <kunittest/runner.h>
00033 
00034 namespace KUnitTest
00035 {
00045     #define KUNITTEST_MODULE(library,suite)                                                 \
00046     static const QString s_kunittest_suite  = QLatin1String(suite);                   \
00047     class library##Module : public QObject                                                  \
00048     {                                                                                       \
00049     public:                                                                                 \
00050         library##Module()                                                                   \
00051         {                                                                                   \
00052             KUnitTest::Registry::const_iterator it = s_registry.constBegin();               \
00053             for( ; it != s_registry.constEnd(); ++it )                                      \
00054                 KUnitTest::Runner::registerTester(it.key(), it.value());                    \
00055         }                                                                                   \
00056                                                                                             \
00057         static KUnitTest::Registry s_registry;                                              \
00058     };                                                                                      \
00059                                                                                             \
00060     KUnitTest::Registry library##Module::s_registry;                                        \
00061                                                                                             \
00062     void kunittest_registerModuleTester(const char *name, KUnitTest::Tester *test)          \
00063     {                                                                                       \
00064         library##Module::s_registry.insert(name, test);                                     \
00065     }                                                                                       \
00066                                                                                             \
00067     class module##Factory : public KLibFactory                                              \
00068     {                                                                                       \
00069     public:                                                                                 \
00070         QObject *createObject (QObject *, const char *, const char *, const QStringList &)  \
00071         {                                                                                   \
00072             return new library##Module();                                                   \
00073         };                                                                                  \
00074     };                                                                                      \
00075                                                                                             \
00076     K_EXPORT_COMPONENT_FACTORY( library, module##Factory )
00077 
00084     #define KUNITTEST_MODULE_REGISTER_TESTER( tester)                                           \
00085     static class tester##ModuleAutoregister                                                     \
00086     {                                                                                           \
00087     public:                                                                                     \
00088         tester##ModuleAutoregister()                                                            \
00089         {                                                                                       \
00090             KUnitTest::Tester *test = new tester();                                             \
00091             QString name = s_kunittest_suite + QLatin1String("::") + QString::fromLocal8Bit(#tester); \
00092             test->setName(name.local8Bit());                                                    \
00093             kunittest_registerModuleTester(name.local8Bit(), test );                            \
00094         }                                                                                       \
00095     } tester##ModuleAutoregisterInstance;
00096 
00102     #define KUNITTEST_MODULE_REGISTER_NAMEDTESTER( name , tester)                             \
00103     static class tester##ModuleAutoregister                                                   \
00104     {                                                                                         \
00105     public:                                                                                   \
00106         tester##ModuleAutoregister()                                                          \
00107         {                                                                                     \
00108             QString fullName = s_kunittest_suite + QString("::") + QString::fromLocal8Bit(name); \
00109             KUnitTest::Tester *test = new tester(fullName.local8Bit());                       \
00110             kunittest_registerModuleTester(fullName.local8Bit(), test);                       \
00111         }                                                                                     \
00112     } tester##ModuleAutoregisterInstance;
00113 }
00114 
00115 #endif

KUnitTest

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal