~clint-fewbar/ubuntu/precise/squid3/ignore-sighup-early

« back to all changes in this revision

Viewing changes to lib/cppunit-1.10.0/src/msvc6/testrunner/MfcTestRunner.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2006-11-11 10:32:06 UTC
  • Revision ID: james.westby@ubuntu.com-20061111103206-f3p0r9g0vq44rp3r
Tags: upstream-3.0.PRE5
ImportĀ upstreamĀ versionĀ 3.0.PRE5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// //////////////////////////////////////////////////////////////////////////
 
2
// Implementation file MfcTestRunner.cpp for class MfcTestRunner
 
3
// (c)Copyright 2000, Baptiste Lepilleur.
 
4
// Created: 2001/04/26
 
5
// //////////////////////////////////////////////////////////////////////////
 
6
 
 
7
#include "StdAfx.h"
 
8
#include <cppunit/ui/mfc/MfcTestRunner.h>
 
9
#include <cppunit/TestSuite.h>
 
10
#include "TestRunnerModel.h"
 
11
#include "TestRunnerDlg.h"
 
12
 
 
13
 
 
14
 
 
15
CPPUNIT_NS_BEGIN
 
16
 
 
17
 
 
18
MfcTestRunner::MfcTestRunner()
 
19
  : m_suite( new CPPUNIT_NS::TestSuite() )
 
20
{
 
21
}
 
22
 
 
23
 
 
24
MfcTestRunner::~MfcTestRunner() 
 
25
{
 
26
  delete m_suite;
 
27
 
 
28
  for ( Tests::iterator it = m_tests.begin(); it != m_tests.end(); ++it )
 
29
    delete *it;
 
30
}
 
31
 
 
32
 
 
33
void 
 
34
MfcTestRunner::run() 
 
35
 
36
  bool comInit = SUCCEEDED( CoInitialize( NULL) );
 
37
 
 
38
  TestRunnerModel model( getRootTest() );
 
39
  TestRunnerDlg dlg( &model ); 
 
40
  dlg.DoModal (); 
 
41
 
 
42
  if ( comInit)
 
43
    CoUninitialize();
 
44
}
 
45
 
 
46
 
 
47
void            
 
48
MfcTestRunner::addTest( CPPUNIT_NS::Test *test ) 
 
49
 
50
  m_tests.push_back( test );
 
51
}
 
52
 
 
53
 
 
54
void            
 
55
MfcTestRunner::addTests( const CppUnitVector<CPPUNIT_NS::Test *> &tests )
 
56
 
57
  for ( Tests::const_iterator it=tests.begin();
 
58
        it != tests.end();
 
59
        ++it )
 
60
  {
 
61
    addTest( *it );
 
62
  }
 
63
}
 
64
 
 
65
 
 
66
CPPUNIT_NS::Test *   
 
67
MfcTestRunner::getRootTest()
 
68
{
 
69
  if ( m_tests.size() != 1 )
 
70
  {
 
71
    for ( Tests::iterator it = m_tests.begin(); it != m_tests.end(); ++it )
 
72
      m_suite->addTest( *it );
 
73
    m_tests.clear();
 
74
    return m_suite;
 
75
  }
 
76
  return m_tests[0];
 
77
}
 
78
 
 
79
CPPUNIT_NS_END