ctkTestRegistry.cpp 613 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * ctkTestRegistry.cpp
  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. #include "ctkTestRegistry.h"
  12. using namespace ctkQA;
  13. ctkTestRegistry* ctkTestRegistry::instance() {
  14. static ctkTestRegistry registry;
  15. return &registry;
  16. }
  17. void ctkTestRegistry::registerTest(QObject* test) {
  18. m_TestSuite += test;
  19. }
  20. int ctkTestRegistry::runTests(int argc, char* argv[]) {
  21. int result = 0;
  22. foreach(QObject* test, m_TestSuite) {
  23. result |= QTest::qExec(test, argc, argv);
  24. }
  25. return result;
  26. }