blob: 13418d355b5429a83ccf5c1ef2fa6bcdbd0c1f1a (
plain)
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
76
77
|
// //////////////////////////////////////////////////////////////////////////
// Implementation file TestPlugInRunnerModel.cpp for class TestPlugInRunnerModel
// (c)Copyright 2000, Baptiste Lepilleur.
// Created: 2001/06/24
// //////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "TestPlugInRunnerModel.h"
#include <cppunit/TestSuite.h>
#include "TestPlugIn.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
TestPlugInRunnerModel::TestPlugInRunnerModel() :
TestRunnerModel( new CPPUNIT_NS::TestSuite( "Default" ) ),
m_plugIn( new TestPlugIn( "default plug-in" ) )
{
}
TestPlugInRunnerModel::~TestPlugInRunnerModel()
{
freeRootTest();
delete m_plugIn;
}
void
TestPlugInRunnerModel::setPlugIn( TestPlugIn *plugIn )
{
freeRootTest();
delete m_plugIn;
m_plugIn = plugIn;
reloadPlugIn();
}
void
TestPlugInRunnerModel::reloadPlugIn()
{
try
{
CWaitCursor waitCursor;
m_history.clear();
freeRootTest();
setRootTest( m_plugIn->makeTest() );
loadHistory();
}
catch (...)
{
setRootTest( new CPPUNIT_NS::TestSuite( "Default" ) );
loadHistory();
throw;
}
}
void
TestPlugInRunnerModel::freeRootTest()
{
delete m_rootTest;
m_rootTest = 0;
}
void
TestPlugInRunnerModel::setRootTest( CPPUNIT_NS::Test *rootTest )
{
freeRootTest();
TestRunnerModel::setRootTest( rootTest );
}
|