test_HYDROGUI_ListModel.h
TestViewer.h
+ TestLib_Listener.h
TestLib_Runner.h
)
test_HYDROGUI_ListModel.cxx
TestViewer.cxx
+ TestLib_Listener.cxx
TestLib_Runner.cxx
)
--- /dev/null
+
+/**
+ @file
+ \brief Implementation of the custom listener printing the time of test execution
+*/
+
+#include <TestLib_Listener.h>
+#include <cppunit/Test.h>
+#include <iostream>
+
+/**
+ \brief Constructor
+*/
+TestLib_Listener::TestLib_Listener()
+{
+}
+
+/**
+ \brief Destructor
+*/
+TestLib_Listener::~TestLib_Listener()
+{
+}
+
+/**
+ \brief Clear the internal state of the listener
+*/
+void TestLib_Listener::Clear()
+{
+}
+
+/**
+ Handler for test start
+ @param theTest the started tests
+*/
+void TestLib_Listener::startTest( CppUnit::Test* theTest )
+{
+ std::string aName;
+ if( theTest )
+ aName = theTest->getName();
+
+ std::cout << aName << "...";
+}
+
+/**
+ Handler for test finish
+ @param theTest the finished tests
+*/
+void TestLib_Listener::endTest( CppUnit::Test* theTest )
+{
+ std::cout << std::endl;
+}
+
+/**
+ Handler for test suite start
+ @param theTest the started test suite
+*/
+void TestLib_Listener::startSuite( CppUnit::Test* theTest )
+{
+}
+
+/**
+ Handler for test suite finish
+ @param theTest the finished test suite
+*/
+void TestLib_Listener::endSuite( CppUnit::Test* theTest )
+{
+}
+
+/**
+ Handler for test failure
+ @param theFailure the failure information
+*/
+void TestLib_Listener::addFailure( const CppUnit::TestFailure& theFailure )
+{
+}
+
--- /dev/null
+
+/**
+ @file
+ \brief Declaration of the custom listener printing the time of test execution
+*/
+
+#pragma once
+
+#include <cppunit/TestListener.h>
+
+/**
+ \class TestLib_Listener
+ \brief Implementation of the custom listener printing the time of test execution
+*/
+class TestLib_Listener : public CppUnit::TestListener
+{
+public:
+ TestLib_Listener();
+ virtual ~TestLib_Listener();
+
+ void Clear();
+
+ virtual void startTest( CppUnit::Test* );
+ virtual void endTest( CppUnit::Test* );
+
+ virtual void startSuite( CppUnit::Test* );
+ virtual void endSuite( CppUnit::Test* );
+
+ virtual void addFailure( const CppUnit::TestFailure& );
+};
+
#include <cppunit/CompilerOutputter.h>
#include <cppunit/TestResult.h>
#include <cppunit/TestResultCollector.h>
-#include <cppunit/TextTestProgressListener.h>
#include <stdexcept>
#include <TestViewer.h>
+#include <TestLib_Listener.h>
#include <TestLib_Runner.h>
#include <OCCViewer_ViewWindow.h>
#include <SUIT_Session.h>
controller.addListener( &result );
// Add a listener that print dots as test run.
- CppUnit::TextTestProgressListener progress;
+ TestLib_Listener progress;
controller.addListener( &progress );
CppUnit::TestFactoryRegistry& registry =