summaryrefslogtreecommitdiff
path: root/src/msvc6/testpluginrunner/TestPlugInRunnerModel.cpp
blob: 93c0b131f0d1a71d312339823ffb2bc52bb2b6be (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
// //////////////////////////////////////////////////////////////////////////
// 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"


TestPlugInRunnerModel::TestPlugInRunnerModel() : 
    TestRunnerModel( new CppUnit::TestSuite( "Default" ) ),
    m_plugIn( new TestPlugIn( "default plug-in" ) )
{
}


TestPlugInRunnerModel::~TestPlugInRunnerModel()
{
  delete m_plugIn;
}


void 
TestPlugInRunnerModel::setPlugIn( TestPlugIn *plugIn )
{
  delete m_plugIn;
  m_plugIn = plugIn;
  reloadPlugIn();
}


void 
TestPlugInRunnerModel::reloadPlugIn()
{
  try 
  {
    setRootTest( m_plugIn->makeTest() );
  }
  catch (...)
  {
    setRootTest( new CppUnit::TestSuite( "Default" ) );  
    loadHistory();
    throw;
  }
}