diff options
| author | Baptiste Lepilleur <gaiacrtn@free.fr> | 2001-06-27 20:23:22 +0000 |
|---|---|---|
| committer | Baptiste Lepilleur <gaiacrtn@free.fr> | 2001-06-27 20:23:22 +0000 |
| commit | 5813e2e80e995893a0a2d2fe4a6f6a8c2155d82c (patch) | |
| tree | 317da54d9f4aaa23d85b996b7624f21f96b010e0 /src/msvc6/testpluginrunner | |
| parent | d52bd686fe91e4c5104b60632ed18eb26ae827f6 (diff) | |
| download | cppunit-5813e2e80e995893a0a2d2fe4a6f6a8c2155d82c.tar.gz | |
Examples/msvc6/CppUnitTestApp/CppUnitTestApp.
examples/msvc6/CppUnitTestApp/CppUnitTestApp.dsp:
moved dll copy from post-build to custom build setting, so that the
dll is copied even if the CppUnitTestApp was not modified.
* examples/msvc6/TestPlugIn/: a new example of test plug in.
* src/msvc6/TestRunner/ListCtrlFormatter.*
* src/msvc6/TestRunner/ListCtrlSetter.*:
added, helper to manipulate list control.
* src/msvc6/TestRunner/TestRunnerDlg.*: change to make the error list
more compact. text moved to string resources. icons added for typ
test tfailure type.
* src/msvc6/TestRunner/MostRecentTests.*: added, classes that will
replace the current implementation of MRU test which make it hard
to subclass the dialog.
* src/msvc6/TestRunner/res/errortype.bmp: added, bitmap with error
types (failure and error).
* src/msvc6/TestPlugInRunner/: A test runner to run test plug in.
Test plug in are DLL that publish a specified plug in interface.
Those DLL are loaded and reloaded by the TestPlugInRunner to run
tests. This remove the need to wrap DLL with a executable to test
them.
* src/cppunit/cppunit.dsp:
removed config.h from project
added Portability.h and config-msvc6.h
* include/cppunit/config-msvc6.h:
undef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST
Diffstat (limited to 'src/msvc6/testpluginrunner')
| -rw-r--r-- | src/msvc6/testpluginrunner/ReadMe.txt | 88 | ||||
| -rw-r--r-- | src/msvc6/testpluginrunner/Resource.h | 31 | ||||
| -rw-r--r-- | src/msvc6/testpluginrunner/StdAfx.cpp | 8 | ||||
| -rw-r--r-- | src/msvc6/testpluginrunner/StdAfx.h | 27 | ||||
| -rw-r--r-- | src/msvc6/testpluginrunner/TestPlugIn.cpp | 122 | ||||
| -rw-r--r-- | src/msvc6/testpluginrunner/TestPlugIn.h | 75 | ||||
| -rw-r--r-- | src/msvc6/testpluginrunner/TestPlugInException.cpp | 43 | ||||
| -rw-r--r-- | src/msvc6/testpluginrunner/TestPlugInException.h | 60 | ||||
| -rw-r--r-- | src/msvc6/testpluginrunner/TestPlugInRunner.dsp | 212 | ||||
| -rw-r--r-- | src/msvc6/testpluginrunner/TestPlugInRunner.dsw | 56 | ||||
| -rw-r--r-- | src/msvc6/testpluginrunner/TestPlugInRunner.rc | 205 | ||||
| -rw-r--r-- | src/msvc6/testpluginrunner/TestPlugInRunnerApp.cpp | 76 | ||||
| -rw-r--r-- | src/msvc6/testpluginrunner/TestPlugInRunnerApp.h | 49 | ||||
| -rw-r--r-- | src/msvc6/testpluginrunner/TestPlugInRunnerDlg.cpp | 134 | ||||
| -rw-r--r-- | src/msvc6/testpluginrunner/TestPlugInRunnerDlg.h | 56 | ||||
| -rw-r--r-- | src/msvc6/testpluginrunner/TestPlugInRunnerModel.cpp | 48 | ||||
| -rw-r--r-- | src/msvc6/testpluginrunner/TestPlugInRunnerModel.h | 48 |
17 files changed, 1338 insertions, 0 deletions
diff --git a/src/msvc6/testpluginrunner/ReadMe.txt b/src/msvc6/testpluginrunner/ReadMe.txt new file mode 100644 index 0000000..fac5260 --- /dev/null +++ b/src/msvc6/testpluginrunner/ReadMe.txt @@ -0,0 +1,88 @@ +======================================================================== + MICROSOFT FOUNDATION CLASS LIBRARY : TestPlugInRunner +======================================================================== + + +AppWizard has created this TestPlugInRunner application for you. This application +not only demonstrates the basics of using the Microsoft Foundation classes +but is also a starting point for writing your application. + +This file contains a summary of what you will find in each of the files that +make up your TestPlugInRunner application. + +TestPlugInRunner.dsp + This file (the project file) contains information at the project level and + is used to build a single project or subproject. Other users can share the + project (.dsp) file, but they should export the makefiles locally. + +TestPlugInRunner.h + This is the main header file for the application. It includes other + project specific headers (including Resource.h) and declares the + TestPlugInRunnerApp application class. + +TestPlugInRunner.cpp + This is the main application source file that contains the application + class TestPlugInRunnerApp. + +TestPlugInRunner.rc + This is a listing of all of the Microsoft Windows resources that the + program uses. It includes the icons, bitmaps, and cursors that are stored + in the RES subdirectory. This file can be directly edited in Microsoft + Visual C++. + +TestPlugInRunner.clw + This file contains information used by ClassWizard to edit existing + classes or add new classes. ClassWizard also uses this file to store + information needed to create and edit message maps and dialog data + maps and to create prototype member functions. + +res\TestPlugInRunner.ico + This is an icon file, which is used as the application's icon. This + icon is included by the main resource file TestPlugInRunner.rc. + +res\TestPlugInRunner.rc2 + This file contains resources that are not edited by Microsoft + Visual C++. You should place all resources not editable by + the resource editor in this file. + + + + +///////////////////////////////////////////////////////////////////////////// + +AppWizard creates one dialog class: + +TestPlugInRunnerDlg.h, TestPlugInRunnerDlg.cpp - the dialog + These files contain your TestPlugInRunnerDlg class. This class defines + the behavior of your application's main dialog. The dialog's + template is in TestPlugInRunner.rc, which can be edited in Microsoft + Visual C++. + + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named TestPlugInRunner.pch and a precompiled types file named StdAfx.obj. + +Resource.h + This is the standard header file, which defines new resource IDs. + Microsoft Visual C++ reads and updates this file. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" to indicate parts of the source code you +should add to or customize. + +If your application uses MFC in a shared DLL, and your application is +in a language other than the operating system's current language, you +will need to copy the corresponding localized resources MFC42XXX.DLL +from the Microsoft Visual C++ CD-ROM onto the system or system32 directory, +and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation. +For example, MFC42DEU.DLL contains resources translated to German.) If you +don't do this, some of the UI elements of your application will remain in the +language of the operating system. + +///////////////////////////////////////////////////////////////////////////// diff --git a/src/msvc6/testpluginrunner/Resource.h b/src/msvc6/testpluginrunner/Resource.h new file mode 100644 index 0000000..7aa669e --- /dev/null +++ b/src/msvc6/testpluginrunner/Resource.h @@ -0,0 +1,31 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by TestPlugInRunner.rc +// +#define IDD_TESTPLUGINRUNNER_DIALOG 102 +#define IDR_MAINFRAME 128 +#define IDR_TEST_PLUGIN_RUNNER 128 +#define IDD_TEST_PLUG_IN_RUNNER 129 +#define IDC_LIST 1000 +#define ID_RUN 1001 +#define ID_STOP 1002 +#define IDC_CHOOSE_DLL 1003 +#define IDC_RELOAD_DLL 1004 +#define IDC_COMBO_TEST 1005 +#define IDC_STATIC_RUNS 1007 +#define IDC_STATIC_ERRORS 1008 +#define IDC_STATIC_FAILURES 1009 +#define IDC_EDIT_TIME 1010 +#define IDC_BROWSE_TEST 1011 +#define IDC_CHECK_AUTORUN 1013 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1005 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/msvc6/testpluginrunner/StdAfx.cpp b/src/msvc6/testpluginrunner/StdAfx.cpp new file mode 100644 index 0000000..f0e3942 --- /dev/null +++ b/src/msvc6/testpluginrunner/StdAfx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// TestPlugInRunner.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + + + diff --git a/src/msvc6/testpluginrunner/StdAfx.h b/src/msvc6/testpluginrunner/StdAfx.h new file mode 100644 index 0000000..f03235c --- /dev/null +++ b/src/msvc6/testpluginrunner/StdAfx.h @@ -0,0 +1,27 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__2CCC624C_C151_496F_A333_28951EA9A8D3__INCLUDED_) +#define AFX_STDAFX_H__2CCC624C_C151_496F_A333_28951EA9A8D3__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers + +#include <afxwin.h> // MFC core and standard components +#include <afxext.h> // MFC extensions +#include <afxdisp.h> // MFC Automation classes +#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include <afxcmn.h> // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__2CCC624C_C151_496F_A333_28951EA9A8D3__INCLUDED_) diff --git a/src/msvc6/testpluginrunner/TestPlugIn.cpp b/src/msvc6/testpluginrunner/TestPlugIn.cpp new file mode 100644 index 0000000..6ab8487 --- /dev/null +++ b/src/msvc6/testpluginrunner/TestPlugIn.cpp @@ -0,0 +1,122 @@ +// ////////////////////////////////////////////////////////////////////////// +// Implementation file TestPlugIn.cpp for class TestPlugIn +// (c)Copyright 2000, Baptiste Lepilleur. +// Created: 2001/06/23 +// ////////////////////////////////////////////////////////////////////////// + +#include "StdAfx.h" +#include "TestPlugIn.h" +#include <cppunit/TestCase.h> +#include "TestPlugInException.h" + + +TestPlugIn::TestPlugIn( const std::string fileName ) : + m_fileName( fileName ), + m_dllHandle( NULL ), + m_interfaceFunction( NULL ) +{ + m_copyFileName = m_fileName + "-hotrunner"; +} + + +TestPlugIn::~TestPlugIn() +{ + releaseDll(); + deleteDllCopy(); +} + + +void +TestPlugIn::releaseDll() +{ + if ( m_dllHandle != NULL ) + ::FreeLibrary( m_dllHandle ); + m_dllHandle = NULL; + m_interfaceFunction = NULL; +} + + +void +TestPlugIn::deleteDllCopy() +{ + ::DeleteFile( m_copyFileName.c_str() ); +} + + +class NullTest : public CppUnit::TestCase +{ +public: + NullTest( std::string name ) : TestCase( name ) + { + } + + ~NullTest() + { + } + + void runTests() + { + CPPUNIT_ASSERT_MESSAGE( "Failed to load" + getName(), FALSE ); + } +}; + + +CppUnit::Test * +TestPlugIn::makeTest() +{ + reloadDll(); + TestPlugInInterface *theInterface = (*m_interfaceFunction)(); + + try + { + return theInterface->makeTest(); + } + catch ( ... ) + { + throw TestPlugInException( "Failed to make test using GetTestPlugInInterface", + TestPlugInException::failedToMakeTest ); + } +} + + +void +TestPlugIn::reloadDll() +{ + releaseDll(); + makeDllCopy(); + loadDll(); + getDllInterface(); +} + + +void +TestPlugIn::makeDllCopy() +{ + if ( ::CopyFile( m_fileName.c_str(), m_copyFileName.c_str(), FALSE ) == FALSE ) + { + throw TestPlugInException( "Failed to copy DLL" + m_fileName + + " to " + m_copyFileName, TestPlugInException::failedToCopyDll ); + } +} + + +void +TestPlugIn::loadDll() +{ + m_dllHandle = ::LoadLibrary( m_copyFileName.c_str() ); + if ( m_dllHandle == NULL ) + throw TestPlugInException( "Failed to load DLL " + m_copyFileName, + TestPlugInException::failedToLoadDll ); +} + + +void +TestPlugIn::getDllInterface() +{ + m_interfaceFunction = (GetTestPlugInInterfaceFunction ) + ::GetProcAddress( m_dllHandle, "GetTestPlugInInterface" ); + if ( m_interfaceFunction == NULL ) + throw TestPlugInException( "Failed to locate function GetTestPlugInInterface " + " in DLL " + m_fileName, + TestPlugInException::failedToGetInterfaceFunction ); +} diff --git a/src/msvc6/testpluginrunner/TestPlugIn.h b/src/msvc6/testpluginrunner/TestPlugIn.h new file mode 100644 index 0000000..2a0402a --- /dev/null +++ b/src/msvc6/testpluginrunner/TestPlugIn.h @@ -0,0 +1,75 @@ +// ////////////////////////////////////////////////////////////////////////// +// Header file TestPlugIn.h for class TestPlugIn +// (c)Copyright 2000, Baptiste Lepilleur. +// Created: 2001/06/23 +// ////////////////////////////////////////////////////////////////////////// +#ifndef TESTPLUGIN_H +#define TESTPLUGIN_H + +#include <string> +#include <cppunit/test.h> +#include <msvc6/testrunner/TestPlugInInterface.h> + + +/*! \class TestPlugIn + * \brief This class represents a test plug-in. + */ +class TestPlugIn +{ +public: + /*! Constructs a TestPlugIn object. + */ + TestPlugIn( const std::string fileName ); + + /*! Destructor. + */ + virtual ~TestPlugIn(); + + /*! Obtains a new test from a new copy of the dll. + * \exception TestPlugInException if a error occurs. + */ + CppUnit::Test *makeTest(); + +private: + /// Prevents the use of the copy constructor. + TestPlugIn( const TestPlugIn © ); + + /// Prevents the use of the copy operator. + void operator =( const TestPlugIn © ); + + void reloadDll(); + void releaseDll(); + void deleteDllCopy(); + + /*! Copy m_fileName DLL to m_copyFileName. + * + * Working on a copy of the DLL allow to update the original DLL. + * \exception TestPlugInException on copy failure. + */ + void makeDllCopy(); + + /*! Load the DLL. + * \exception TestPlugInException on dll loading failure. + */ + void loadDll(); + + /*! Get a pointer on the function "GetTestPlugInInterface" of the DLL. + * \exception TestPlugInException if the function does not exist. + */ + void getDllInterface(); + +private: + std::string m_fileName; + std::string m_copyFileName; + HINSTANCE m_dllHandle; + GetTestPlugInInterfaceFunction m_interfaceFunction; +}; + + + +// Inlines methods for TestPlugIn: +// ------------------------------- + + + +#endif // TESTPLUGIN_H diff --git a/src/msvc6/testpluginrunner/TestPlugInException.cpp b/src/msvc6/testpluginrunner/TestPlugInException.cpp new file mode 100644 index 0000000..f006c0f --- /dev/null +++ b/src/msvc6/testpluginrunner/TestPlugInException.cpp @@ -0,0 +1,43 @@ +// ////////////////////////////////////////////////////////////////////////// +// Implementation file TestPlugInException.cpp for class TestPlugInException +// (c)Copyright 2000, Baptiste Lepilleur. +// Created: 2001/06/23 +// ////////////////////////////////////////////////////////////////////////// + +#include "StdAfx.h" +#include "TestPlugInException.h" + + +TestPlugInException::TestPlugInException( std::string message, + Cause cause ) : + runtime_error( message ), + m_cause( cause ) +{ +} + + +TestPlugInException::TestPlugInException( const TestPlugInException © ) : + runtime_error( copy ) +{ +} + + +TestPlugInException::~TestPlugInException() +{ +} + + +TestPlugInException & +TestPlugInException::operator =( const TestPlugInException © ) +{ + runtime_error::operator =( copy ); + m_cause = copy.m_cause; + return *this; +} + + +TestPlugInException::Cause +TestPlugInException::getCause() const +{ + return m_cause; +} diff --git a/src/msvc6/testpluginrunner/TestPlugInException.h b/src/msvc6/testpluginrunner/TestPlugInException.h new file mode 100644 index 0000000..15005dc --- /dev/null +++ b/src/msvc6/testpluginrunner/TestPlugInException.h @@ -0,0 +1,60 @@ +// ////////////////////////////////////////////////////////////////////////// +// Header file TestPlugInException.h for class TestPlugInException +// (c)Copyright 2000, Baptiste Lepilleur. +// Created: 2001/06/23 +// ////////////////////////////////////////////////////////////////////////// +#ifndef TESTPLUGINEXCEPTION_H +#define TESTPLUGINEXCEPTION_H + +#include <stdexcept> +#include <string> + + +/*! \class TestPlugInException + * \brief This class represents a failure of using the test plug-in. + */ +class TestPlugInException : public std::runtime_error +{ +public: + enum Cause + { + failedToLoadDll =0, + failedToCopyDll, + failedToGetInterfaceFunction, + failedToMakeTest + }; + + /*! Constructs a TestPlugInException object. + */ + TestPlugInException( std::string message, + Cause cause ); + + /*! Copy constructor. + * @param copy Object to copy. + */ + TestPlugInException( const TestPlugInException © ); + + /*! Destructor. + */ + virtual ~TestPlugInException(); + + /*! Copy operator. + * @param copy Object to copy. + * @return Reference on this object. + */ + TestPlugInException &operator =( const TestPlugInException © ); + + Cause getCause() const; + +private: + Cause m_cause; +}; + + + +// Inlines methods for TestPlugInException: +// ---------------------------------------- + + + +#endif // TESTPLUGINEXCEPTION_H diff --git a/src/msvc6/testpluginrunner/TestPlugInRunner.dsp b/src/msvc6/testpluginrunner/TestPlugInRunner.dsp new file mode 100644 index 0000000..9b0a1f8 --- /dev/null +++ b/src/msvc6/testpluginrunner/TestPlugInRunner.dsp @@ -0,0 +1,212 @@ +# Microsoft Developer Studio Project File - Name="TestPlugInRunner" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=TestPlugInRunner - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "TestPlugInRunner.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "TestPlugInRunner.mak" CFG="TestPlugInRunner - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "TestPlugInRunner - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "TestPlugInRunner - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "TestPlugInRunner - Win32 Release" + +# PROP BASE Use_MFC 6 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 6 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x40c /d "NDEBUG" /d "_AFXDLL" +# ADD RSC /l 0x40c /d "NDEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 +# ADD LINK32 /nologo /subsystem:windows /machine:I386 + +!ELSEIF "$(CFG)" == "TestPlugInRunner - Win32 Debug" + +# PROP BASE Use_MFC 6 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 6 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "../../include" /I "../TestRunner" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x40c /d "_DEBUG" /d "_AFXDLL" +# ADD RSC /l 0x40c /d "_DEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 ../../../lib/cppunitd.lib ../../../lib/testrunnerd.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# Begin Custom Build +IntDir=.\Debug +InputPath=.\Debug\TestPlugInRunner.exe +SOURCE="$(InputPath)" + +"$(IntDir)\testrunned.dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + copy ..\..\..\lib\testrunnerd.dll $(IntDir) + +# End Custom Build + +!ENDIF + +# Begin Target + +# Name "TestPlugInRunner - Win32 Release" +# Name "TestPlugInRunner - Win32 Debug" +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\res\ico00001.ico +# End Source File +# Begin Source File + +SOURCE=..\testrunner\res\ico00001.ico +# End Source File +# Begin Source File + +SOURCE=..\testrunner\res\ico00002.ico +# End Source File +# Begin Source File + +SOURCE=..\testrunner\res\idr_test.ico +# End Source File +# Begin Source File + +SOURCE=..\testrunner\res\test_type.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\TestPlugInRunner.ico +# End Source File +# Begin Source File + +SOURCE=.\res\TestPlugInRunner.rc2 +# End Source File +# Begin Source File + +SOURCE=..\testrunner\res\tfwkui_r.bmp +# End Source File +# End Group +# Begin Group "Gui" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\TestPlugInRunner.rc +# End Source File +# Begin Source File + +SOURCE=.\TestPlugInRunnerApp.cpp +# End Source File +# Begin Source File + +SOURCE=.\TestPlugInRunnerApp.h +# End Source File +# Begin Source File + +SOURCE=.\TestPlugInRunnerDlg.cpp +# End Source File +# Begin Source File + +SOURCE=.\TestPlugInRunnerDlg.h +# End Source File +# End Group +# Begin Group "Interface" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\..\..\include\msvc6\testrunner\TestPlugInInterface.h +# End Source File +# End Group +# Begin Group "Models" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\TestPlugIn.cpp +# End Source File +# Begin Source File + +SOURCE=.\TestPlugIn.h +# End Source File +# Begin Source File + +SOURCE=.\TestPlugInException.cpp +# End Source File +# Begin Source File + +SOURCE=.\TestPlugInException.h +# End Source File +# Begin Source File + +SOURCE=.\TestPlugInRunnerModel.cpp +# End Source File +# Begin Source File + +SOURCE=.\TestPlugInRunnerModel.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff --git a/src/msvc6/testpluginrunner/TestPlugInRunner.dsw b/src/msvc6/testpluginrunner/TestPlugInRunner.dsw new file mode 100644 index 0000000..40729d7 --- /dev/null +++ b/src/msvc6/testpluginrunner/TestPlugInRunner.dsw @@ -0,0 +1,56 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "CppUnitTestApp"=..\..\..\examples\msvc6\CppUnitTestApp\CppUnitTestApp.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "TestPlugInRunner"=.\TestPlugInRunner.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name TestRunner + End Project Dependency +}}} + +############################################################################### + +Project: "TestRunner"=..\testrunner\TestRunner.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/src/msvc6/testpluginrunner/TestPlugInRunner.rc b/src/msvc6/testpluginrunner/TestPlugInRunner.rc new file mode 100644 index 0000000..f66776c --- /dev/null +++ b/src/msvc6/testpluginrunner/TestPlugInRunner.rc @@ -0,0 +1,205 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_TEST_PLUG_IN_RUNNER DIALOG DISCARDABLE 0, 0, 403, 215 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "TestRunner" +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "&Browse",IDC_BROWSE_TEST,346,16,50,14 + DEFPUSHBUTTON "&Run",ID_RUN,346,39,50,14 + LTEXT "Test name:",IDC_STATIC,7,7,179,9 + COMBOBOX IDC_COMBO_TEST,7,17,332,157,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + CONTROL "&Autorun at startup",IDC_CHECK_AUTORUN,"Button", + BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,347,67,49,25 + PUSHBUTTON "&Stop",ID_STOP,346,175,50,14 + PUSHBUTTON "&Close",IDOK,346,194,50,14 + LTEXT "Progress:",IDC_STATIC,7,38,49,9 + LTEXT "Runs:",IDC_STATIC,103,76,29,10 + LTEXT "0",IDC_STATIC_RUNS,141,76,19,8 + LTEXT "Errors:",IDC_STATIC,169,76,29,10 + LTEXT "0",IDC_STATIC_ERRORS,207,76,19,8 + LTEXT "Failures:",IDC_STATIC,235,76,29,10 + LTEXT "0",IDC_STATIC_FAILURES,273,76,19,8 + LTEXT "Errors and Failures:",IDC_STATIC,7,94,67,9 + CONTROL "List1",IDC_LIST,"SysListView32",LVS_REPORT | WS_BORDER | + WS_TABSTOP,7,105,331,86 + EDITTEXT IDC_EDIT_TIME,7,195,332,13,ES_AUTOHSCROLL | ES_READONLY + PUSHBUTTON "&Choose DLL",IDC_CHOOSE_DLL,346,97,50,14 + PUSHBUTTON "Re&load DLL",IDC_RELOAD_DLL,346,122,50,14 +END + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "\0" + VALUE "FileDescription", "TestPlugInRunner MFC Application\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "TestPlugInRunner\0" + VALUE "LegalCopyright", "Copyright (C) 2001\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "TestPlugInRunner.EXE\0" + VALUE "ProductName", "TestPlugInRunner Application\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_TEST_PLUG_IN_RUNNER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 396 + TOPMARGIN, 7 + BOTTOMMARGIN, 208 + END +END +#endif // APSTUDIO_INVOKED + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// French (France) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) +#ifdef _WIN32 +LANGUAGE LANG_FRENCH, SUBLANG_FRENCH +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "#ifdef _WIN32\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#endif //_WIN32\r\n" + "#include ""res\\TestPlugInRunner.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "#endif\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDR_TEST_PLUGIN_RUNNER ICON DISCARDABLE "res\\TestPlugInRunner.ico" +#endif // French (France) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE 9, 1 +#pragma code_page(1252) +#endif //_WIN32 +#include "res\TestPlugInRunner.rc2" // non-Microsoft Visual C++ edited resources +#include "afxres.rc" // Standard components +#endif + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/msvc6/testpluginrunner/TestPlugInRunnerApp.cpp b/src/msvc6/testpluginrunner/TestPlugInRunnerApp.cpp new file mode 100644 index 0000000..e81fa49 --- /dev/null +++ b/src/msvc6/testpluginrunner/TestPlugInRunnerApp.cpp @@ -0,0 +1,76 @@ +// TestPlugInRunner.cpp : Defines the class behaviors for the application. +// + +#include "stdafx.h" +#include "TestPlugInRunnerApp.h" +#include "TestPlugInRunnerDlg.h" +#include "TestPlugInRunnerModel.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// TestPlugInRunnerApp + +BEGIN_MESSAGE_MAP(TestPlugInRunnerApp, CWinApp) + //{{AFX_MSG_MAP(TestPlugInRunnerApp) + // NOTE - the ClassWizard will add and remove mapping macros here. + // DO NOT EDIT what you see in these blocks of generated code! + //}}AFX_MSG + ON_COMMAND(ID_HELP, CWinApp::OnHelp) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// TestPlugInRunnerApp construction + +TestPlugInRunnerApp::TestPlugInRunnerApp() +{ + // TODO: add construction code here, + // Place all significant initialization in InitInstance +} + +///////////////////////////////////////////////////////////////////////////// +// The one and only TestPlugInRunnerApp object + +TestPlugInRunnerApp theApp; + +///////////////////////////////////////////////////////////////////////////// +// TestPlugInRunnerApp initialization + +BOOL TestPlugInRunnerApp::InitInstance() +{ + AfxEnableControlContainer(); + + // Standard initialization + // If you are not using these features and wish to reduce the size + // of your final executable, you should remove from the following + // the specific initialization routines you do not need. + +#ifdef _AFXDLL + Enable3dControls(); // Call this when using MFC in a shared DLL +#else + Enable3dControlsStatic(); // Call this when linking to MFC statically +#endif + + TestPlugInRunnerModel model; + TestPlugInRunnerDlg dlg( &model ); + m_pMainWnd = &dlg; + int nResponse = dlg.DoModal(); + if (nResponse == IDOK) + { + // TODO: Place code here to handle when the dialog is + // dismissed with OK + } + else if (nResponse == IDCANCEL) + { + // TODO: Place code here to handle when the dialog is + // dismissed with Cancel + } + + // Since the dialog has been closed, return FALSE so that we exit the + // application, rather than start the application's message pump. + return FALSE; +} diff --git a/src/msvc6/testpluginrunner/TestPlugInRunnerApp.h b/src/msvc6/testpluginrunner/TestPlugInRunnerApp.h new file mode 100644 index 0000000..fc022d2 --- /dev/null +++ b/src/msvc6/testpluginrunner/TestPlugInRunnerApp.h @@ -0,0 +1,49 @@ +// TestPlugInRunner.h : main header file for the TESTPLUGINRUNNER application +// + +#if !defined(AFX_TESTPLUGINRUNNER_H__C64A0384_27BB_4A9A_854C_B19BF07A81F8__INCLUDED_) +#define AFX_TESTPLUGINRUNNER_H__C64A0384_27BB_4A9A_854C_B19BF07A81F8__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef __AFXWIN_H__ + #error include 'stdafx.h' before including this file for PCH +#endif + +#include "resource.h" // main symbols + +///////////////////////////////////////////////////////////////////////////// +// TestPlugInRunnerApp: +// See TestPlugInRunner.cpp for the implementation of this class +// + +class TestPlugInRunnerApp : public CWinApp +{ +public: + TestPlugInRunnerApp(); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(TestPlugInRunnerApp) + public: + virtual BOOL InitInstance(); + //}}AFX_VIRTUAL + +// Implementation + + //{{AFX_MSG(TestPlugInRunnerApp) + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_TESTPLUGINRUNNER_H__C64A0384_27BB_4A9A_854C_B19BF07A81F8__INCLUDED_) diff --git a/src/msvc6/testpluginrunner/TestPlugInRunnerDlg.cpp b/src/msvc6/testpluginrunner/TestPlugInRunnerDlg.cpp new file mode 100644 index 0000000..c7b55d7 --- /dev/null +++ b/src/msvc6/testpluginrunner/TestPlugInRunnerDlg.cpp @@ -0,0 +1,134 @@ +// TestPlugInRunnerDlg.cpp : implementation file +// + +#include "stdafx.h" +#include "resource.h" +#include "TestPlugInRunnerDlg.h" +#include "TestPlugIn.h" +#include "TestPlugInException.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// TestPlugInRunnerDlg dialog + +TestPlugInRunnerDlg::TestPlugInRunnerDlg( TestPlugInRunnerModel *model, + CWnd* pParent ) : + TestRunnerDlg( model, IDD_TEST_PLUG_IN_RUNNER, pParent ) +{ + //{{AFX_DATA_INIT(TestPlugInRunnerDlg) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 + m_hIcon = AfxGetApp()->LoadIcon(IDR_TEST_PLUGIN_RUNNER); +} + +void TestPlugInRunnerDlg::DoDataExchange(CDataExchange* pDX) +{ + TestRunnerDlg::DoDataExchange(pDX); + //{{AFX_DATA_MAP(TestPlugInRunnerDlg) + // NOTE: the ClassWizard will add DDX and DDV calls here + //}}AFX_DATA_MAP +} + +BEGIN_MESSAGE_MAP(TestPlugInRunnerDlg, TestRunnerDlg) + //{{AFX_MSG_MAP(TestPlugInRunnerDlg) + ON_WM_PAINT() + ON_WM_QUERYDRAGICON() + ON_BN_CLICKED(IDC_CHOOSE_DLL, OnChooseDll) + ON_BN_CLICKED(IDC_RELOAD_DLL, OnReloadDll) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// TestPlugInRunnerDlg message handlers + +BOOL TestPlugInRunnerDlg::OnInitDialog() +{ + TestRunnerDlg::OnInitDialog(); + + // Set the icon for this dialog. The framework does this automatically + // when the application's main window is not a dialog + SetIcon(m_hIcon, TRUE); // Set big icon + SetIcon(m_hIcon, FALSE); // Set small icon + + // TODO: Add extra initialization here + + return TRUE; // return TRUE unless you set the focus to a control +} + +// If you add a minimize button to your dialog, you will need the code below +// to draw the icon. For MFC applications using the document/view model, +// this is automatically done for you by the framework. + +void TestPlugInRunnerDlg::OnPaint() +{ + if (IsIconic()) + { + CPaintDC dc(this); // device context for painting + + SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); + + // Center icon in client rectangle + int cxIcon = GetSystemMetrics(SM_CXICON); + int cyIcon = GetSystemMetrics(SM_CYICON); + CRect rect; + GetClientRect(&rect); + int x = (rect.Width() - cxIcon + 1) / 2; + int y = (rect.Height() - cyIcon + 1) / 2; + + // Draw the icon + dc.DrawIcon(x, y, m_hIcon); + } + else + { + TestRunnerDlg::OnPaint(); + } +} + +// The system calls this to obtain the cursor to display while the user drags +// the minimized window. +HCURSOR TestPlugInRunnerDlg::OnQueryDragIcon() +{ + return (HCURSOR) m_hIcon; +} + + +TestPlugInRunnerModel & +TestPlugInRunnerDlg::plugInModel() +{ + return *static_cast<TestPlugInRunnerModel*>( m_model ); +} + + +void +TestPlugInRunnerDlg::OnChooseDll() +{ + CFileDialog dlg( TRUE, "*.dll", "", 0, + "Test Plug-in (*.dll)|*.dll|All Files (*.*)|*.*||", + this ); + if ( dlg.DoModal() != IDOK ) + return; + + try + { + TestPlugIn *plugIn = new TestPlugIn( std::string( dlg.GetPathName() ) ); + plugInModel().setPlugIn( plugIn ); + updateHistoryCombo(); + } + catch ( TestPlugInException &e ) + { + AfxMessageBox( e.what() ); + } +} + + +void +TestPlugInRunnerDlg::OnReloadDll() +{ + plugInModel().reloadPlugIn(); +} diff --git a/src/msvc6/testpluginrunner/TestPlugInRunnerDlg.h b/src/msvc6/testpluginrunner/TestPlugInRunnerDlg.h new file mode 100644 index 0000000..6a4dc20 --- /dev/null +++ b/src/msvc6/testpluginrunner/TestPlugInRunnerDlg.h @@ -0,0 +1,56 @@ +// TestPlugInRunnerDlg.h : header file +// + +#if !defined(AFX_TESTPLUGINRUNNERDLG_H__AF6DB5BC_25E5_4459_8A54_9704298F64FF__INCLUDED_) +#define AFX_TESTPLUGINRUNNERDLG_H__AF6DB5BC_25E5_4459_8A54_9704298F64FF__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include <TestRunnerDlg.h> +#include <TestRunnerModel.h> +#include "TestPlugInRunnerModel.h" + +///////////////////////////////////////////////////////////////////////////// +// TestPlugInRunnerDlg dialog + +class TestPlugInRunnerDlg : public TestRunnerDlg +{ +// Construction +public: + TestPlugInRunnerDlg( TestPlugInRunnerModel *model, + CWnd* pParent = NULL); + +// Dialog Data + //{{AFX_DATA(TestPlugInRunnerDlg) + enum { IDD = IDD_TEST_PLUG_IN_RUNNER }; + //}}AFX_DATA + + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(TestPlugInRunnerDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + HICON m_hIcon; + + // Generated message map functions + //{{AFX_MSG(TestPlugInRunnerDlg) + virtual BOOL OnInitDialog(); + afx_msg void OnPaint(); + afx_msg HCURSOR OnQueryDragIcon(); + afx_msg void OnChooseDll(); + afx_msg void OnReloadDll(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP(); +private: + TestPlugInRunnerModel &plugInModel(); +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_TESTPLUGINRUNNERDLG_H__AF6DB5BC_25E5_4459_8A54_9704298F64FF__INCLUDED_) diff --git a/src/msvc6/testpluginrunner/TestPlugInRunnerModel.cpp b/src/msvc6/testpluginrunner/TestPlugInRunnerModel.cpp new file mode 100644 index 0000000..93c0b13 --- /dev/null +++ b/src/msvc6/testpluginrunner/TestPlugInRunnerModel.cpp @@ -0,0 +1,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; + } +} diff --git a/src/msvc6/testpluginrunner/TestPlugInRunnerModel.h b/src/msvc6/testpluginrunner/TestPlugInRunnerModel.h new file mode 100644 index 0000000..b6c12d6 --- /dev/null +++ b/src/msvc6/testpluginrunner/TestPlugInRunnerModel.h @@ -0,0 +1,48 @@ +// ////////////////////////////////////////////////////////////////////////// +// Header file TestPlugInRunnerModel.h for class TestPlugInRunnerModel +// (c)Copyright 2000, Baptiste Lepilleur. +// Created: 2001/06/24 +// ////////////////////////////////////////////////////////////////////////// +#ifndef TESTPLUGINRUNNERMODEL_H +#define TESTPLUGINRUNNERMODEL_H + +#include <TestRunnerModel.h> +class TestPlugIn; + + +/*! \class TestPlugInRunnerModel + * \brief This class represents a model for the plug in runner. + */ +class TestPlugInRunnerModel : public TestRunnerModel +{ +public: + /*! Constructs a TestPlugInRunnerModel object. + */ + TestPlugInRunnerModel(); + + /*! Destructor. + */ + virtual ~TestPlugInRunnerModel(); + + void setPlugIn( TestPlugIn *plugIn ); + + void reloadPlugIn(); +private: + /// Prevents the use of the copy constructor. + TestPlugInRunnerModel( const TestPlugInRunnerModel © ); + + /// Prevents the use of the copy operator. + void operator =( const TestPlugInRunnerModel © ); + +private: + TestPlugIn *m_plugIn; +}; + + + +// Inlines methods for TestPlugInRunnerModel: +// ------------------------------------------ + + + +#endif // TESTPLUGINRUNNERMODEL_H |
