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

KUnitTest

  • sources
  • kde-4.12
  • kdelibs
  • kde3support
  • kunittest
module.h
Go to the documentation of this file.
1 
26 #ifndef KUNITTEST_MODULE_H
27 #define KUNITTEST_MODULE_H
28 
29 #include <QtCore/QString>
30 
31 #include <klibloader.h>
32 #include <kunittest/runner.h>
33 
34 namespace KUnitTest
35 {
45  #define KUNITTEST_MODULE(library,suite) \
46  static const QString s_kunittest_suite = QLatin1String(suite); \
47  class library##Module : public QObject \
48  { \
49  public: \
50  library##Module() \
51  { \
52  KUnitTest::Registry::const_iterator it = s_registry.constBegin(); \
53  for( ; it != s_registry.constEnd(); ++it ) \
54  KUnitTest::Runner::registerTester(it.key(), it.value()); \
55  } \
56  \
57  static KUnitTest::Registry s_registry; \
58  }; \
59  \
60  KUnitTest::Registry library##Module::s_registry; \
61  \
62  void kunittest_registerModuleTester(const char *name, KUnitTest::Tester *test) \
63  { \
64  library##Module::s_registry.insert(name, test); \
65  } \
66  \
67  class module##Factory : public KLibFactory \
68  { \
69  public: \
70  QObject *createObject (QObject *, const char *, const char *, const QStringList &) \
71  { \
72  return new library##Module(); \
73  }; \
74  }; \
75  \
76  K_EXPORT_COMPONENT_FACTORY( library, module##Factory )
77 
84  #define KUNITTEST_MODULE_REGISTER_TESTER( tester) \
85  static class tester##ModuleAutoregister \
86  { \
87  public: \
88  tester##ModuleAutoregister() \
89  { \
90  KUnitTest::Tester *test = new tester(); \
91  QString name = s_kunittest_suite + QLatin1String("::") + QString::fromLocal8Bit(#tester); \
92  test->setName(name.local8Bit()); \
93  kunittest_registerModuleTester(name.local8Bit(), test ); \
94  } \
95  } tester##ModuleAutoregisterInstance;
96 
102  #define KUNITTEST_MODULE_REGISTER_NAMEDTESTER( name , tester) \
103  static class tester##ModuleAutoregister \
104  { \
105  public: \
106  tester##ModuleAutoregister() \
107  { \
108  QString fullName = s_kunittest_suite + QString("::") + QString::fromLocal8Bit(name); \
109  KUnitTest::Tester *test = new tester(fullName.local8Bit()); \
110  kunittest_registerModuleTester(fullName.local8Bit(), test); \
111  } \
112  } tester##ModuleAutoregisterInstance;
113 }
114 
115 #endif
runner.h
klibloader.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:52:07 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KUnitTest

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

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