QtTestRunner.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // //////////////////////////////////////////////////////////////////////////
  2. // Header file TestRunner.h for class TestRunner
  3. // (c)Copyright 2000, Baptiste Lepilleur.
  4. // Created: 2001/09/19
  5. // //////////////////////////////////////////////////////////////////////////
  6. #ifndef CPPUNIT_QTUI_QTTESTRUNNER_H
  7. #define CPPUNIT_QTUI_QTTESTRUNNER_H
  8. #include <cppunit/portability/CppUnitVector.h>
  9. #include "Config.h"
  10. CPPUNIT_NS_BEGIN
  11. class Test;
  12. class TestSuite;
  13. /*!
  14. * \brief QT test runner.
  15. * \ingroup ExecutingTest
  16. *
  17. * Here is an example of usage:
  18. * \code
  19. * #include <cppunit/extensions/TestFactoryRegistry.h>
  20. * #include <cppunit/ui/qt/TestRunner.h>
  21. *
  22. * [...]
  23. *
  24. * void
  25. * QDepWindow::runTests()
  26. * {
  27. * CppUnit::QtUi::TestRunner runner;
  28. * runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() );
  29. * runner.run( true );
  30. * }
  31. * \endcode
  32. *
  33. */
  34. class QTTESTRUNNER_API QtTestRunner
  35. {
  36. public:
  37. /*! Constructs a TestRunner object.
  38. */
  39. QtTestRunner();
  40. /*! Destructor.
  41. */
  42. virtual ~QtTestRunner();
  43. void run( bool autoRun =false );
  44. void addTest( Test *test );
  45. private:
  46. /// Prevents the use of the copy constructor.
  47. QtTestRunner( const QtTestRunner &copy );
  48. /// Prevents the use of the copy operator.
  49. void operator =( const QtTestRunner &copy );
  50. Test *getRootTest();
  51. private:
  52. typedef CppUnitVector<Test *> Tests;
  53. Tests *_tests;
  54. TestSuite *_suite;
  55. };
  56. #if CPPUNIT_HAVE_NAMESPACES
  57. namespace QtUi
  58. {
  59. /*! Qt TestRunner (DEPRECATED).
  60. * \deprecated Use CppUnit::QtTestRunner instead.
  61. */
  62. typedef CPPUNIT_NS::QtTestRunner TestRunner;
  63. }
  64. #endif
  65. CPPUNIT_NS_END
  66. #endif // CPPUNIT_QTUI_QTTESTRUNNER_H