summaryrefslogtreecommitdiff
path: root/examples/ClockerPlugIn/ClockerListener.h
blob: 17d85d4e49f2513240b9a0e30d29c1c538437255 (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
// //////////////////////////////////////////////////////////////////////////
// Header file ClockerListener.h for class ClockerListener
// (c)Copyright 2000, Baptiste Lepilleur.
// Created: 2002/04/19
// //////////////////////////////////////////////////////////////////////////
#ifndef CLOCKERLISTENER_H
#define CLOCKERLISTENER_H

#include <cppunit/TestListener.h>

class ClockerModel;


/// TestListener that prints a flatten or hierarchical view of the test tree.
class ClockerListener : public CPPUNIT_NS::TestListener
{
public:
  ClockerListener( ClockerModel *model,
                   bool text );

  virtual ~ClockerListener();

  void startTestRun( CPPUNIT_NS::Test *test, 
                     CPPUNIT_NS::TestResult *eventManager );

  void endTestRun( CPPUNIT_NS::Test *test, 
                   CPPUNIT_NS::TestResult *eventManager );

  void startTest( CPPUNIT_NS::Test *test );

  void endTest( CPPUNIT_NS::Test *test );

  void startSuite( CPPUNIT_NS::Test *suite );

  void endSuite( CPPUNIT_NS::Test *suite );

private:
  void printStatistics() const;

  void printTest( int testIndex,
                  const std::string &indentString ) const;

  void printTestIndent( const std::string &indent,
                        const int indentLength ) const;

  void printTime( double time ) const;

  /// Prevents the use of the copy constructor.
  ClockerListener( const ClockerListener &other );

  /// Prevents the use of the copy operator.
  void operator =( const ClockerListener &other );

private:
  ClockerModel *m_model;
  bool m_text;
};



// Inlines methods for ClockerListener:
// -----------------------------------



#endif  // CLOCKERLISTENER_H