1 |
c137512e
|
Oto Šťáva
|
/*
|
2 |
|
|
* Copyright (C) 2008 Remko Troncon
|
3 |
|
|
* Licensed under the MIT license.
|
4 |
|
|
* See COPYING for license details.
|
5 |
|
|
*/
|
6 |
|
|
|
7 |
|
|
#include "QtTestUtil/TestRegistry.h"
|
8 |
|
|
|
9 |
|
|
#include <QtTest/QtTest>
|
10 |
|
|
|
11 |
|
|
namespace QtTestUtil {
|
12 |
|
|
|
13 |
|
|
TestRegistry* TestRegistry::getInstance() {
|
14 |
|
|
static TestRegistry registry;
|
15 |
|
|
return ®istry;
|
16 |
|
|
}
|
17 |
|
|
|
18 |
|
|
void TestRegistry::registerTest(QObject* test) {
|
19 |
|
|
tests_ += test;
|
20 |
|
|
}
|
21 |
|
|
|
22 |
|
|
int TestRegistry::runTests(int argc, char* argv[]) {
|
23 |
|
|
int result = 0;
|
24 |
|
|
foreach(QObject* test, tests_) {
|
25 |
|
|
result |= QTest::qExec(test, argc, argv);
|
26 |
|
|
}
|
27 |
|
|
return result;
|
28 |
|
|
}
|
29 |
|
|
|
30 |
|
|
}
|