ctkTestRegistry.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * ctkTestRegistry.h
  3. * ctkTestSuiteEngine
  4. *
  5. * Created by Paolo Quadrani on 17/09/09.
  6. * Copyright 2009 B3C. All rights reserved.
  7. *
  8. * See Licence at: http://tiny.cc/QXJ4D
  9. *
  10. */
  11. #ifndef TESTREGISTRY_
  12. #define TESTREGISTRY_
  13. // Includes list
  14. #include <QtTest/QtTest>
  15. namespace ctkQA {
  16. // Class forwarding list
  17. /**
  18. * A registry of QtTest test classes.
  19. * All test classes registered with CTK_REGISTER_TEST add
  20. * themselves to this registry. All registered tests can then be run at
  21. * once using runTests().
  22. */
  23. class ctkTestRegistry {
  24. public:
  25. ///!brief Retrieve the single instance of the registry.
  26. static ctkTestRegistry* instance();
  27. ///!brief Register a QtTest test.
  28. /** This method is called by CTK_REGISTER_TEST, and you should
  29. not use this method directly.
  30. */
  31. void registerTest(QObject*);
  32. ///!brief Run all registered tests using QTest::qExec()
  33. int runTests(int argc, char* argv[]);
  34. private:
  35. ///!brief Private constructor for the singletone.
  36. ctkTestRegistry() {}
  37. private:
  38. QList<QObject*> m_TestSuite; ///< Test suite list
  39. };
  40. }
  41. #endif // TESTREGISTRY_