Menu

[r242]: / trunk / cppunit / src / qttestrunner / TestRunner.cpp  Maximize  Restore  History

Download this file

76 lines (58 with data), 1.5 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// //////////////////////////////////////////////////////////////////////////
// Implementation file TestRunner.cpp for class TestRunner
// (c)Copyright 2000, Baptiste Lepilleur.
// Created: 2001/09/19
// //////////////////////////////////////////////////////////////////////////
#include <qapplication.h>
#include <cppunit/TestSuite.h>
#include <cppunit/ui/qt/TestRunner.h>
#include "TestRunnerDlgImpl.h"
#include "TestRunnerModel.h"
namespace CppUnit
{
namespace QtUi
{
TestRunner::TestRunner() :
_suite( new CppUnit::TestSuite( "All Tests" ) ),
_tests( new Tests() )
{
}
TestRunner::~TestRunner()
{
delete _suite;
Tests::iterator it = _tests->begin();
while ( it != _tests->end() )
delete *it++;
delete _tests;
}
Test *
TestRunner::getRootTest()
{
if ( _tests->size() != 1 )
{
Tests::iterator it = _tests->begin();
while ( it != _tests->end() )
_suite->addTest( *it++ );
_tests->clear();
return _suite;
}
return (*_tests)[0];
}
void
TestRunner::run( bool autoRun )
{
TestRunnerDlg *dlg = new TestRunnerDlg( qApp->mainWidget(),
"TestRunner",
TRUE );
dlg->setModel( new TestRunnerModel( getRootTest() ),
autoRun );
dlg->exec();
delete dlg;
}
void
TestRunner::addTest( CppUnit::Test *test )
{
_tests->push_back( test );
}
} // namespace QtUi
} // namespace CppUnit
MongoDB Logo MongoDB