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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
#if !defined(AFX_TESTRUNNERDLG_H)
#define AFX_TESTRUNNERDLG_H
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// TestRunnerDlg.h : header file
//
/* Refer to MSDN documentation:
mk:@MSITStore:h:\DevStudio\MSDN\98VSa\1036\vcmfc.chm::/html/_mfcnotes_tn033.htm#_mfcnotes_how_to_write_an_mfc_extension_dll
to know how to write and use MFC extension DLL
Can be found in the index with "mfc extension"
=>
Using:
- your application must link Multithreaded MFC DLL
- memory allocation is done using the same heap
- you must define the symbol _AFX_DLL
Building:
- you must define the symbol _AFX_DLL and _AFX_EXT
*/
// Define the folowing symbol to subclass TestRunnerDlg
#ifndef CPPUNIT_SUBCLASSING_TESTRUNNERDLG_BUILD
#include "resource.h"
#else
#define IDD_DIALOG_TESTRUNNER 0
#endif
#include <vector>
#include <cppunit/TestSuite.h>
#include <cppunit/Exception.h>
#include <cppunit/TestResult.h>
#include <cppunit/TestListener.h>
#include <cppunit/TestResultCollector.h>
#include "ActiveTest.h"
#include "MsDevCallerListCtrl.h"
#include "TestRunnerModel.h"
#include "DynamicWindow/cdxCDynamicDialog.h"
class ProgressBar;
class TestRunnerModel;
/////////////////////////////////////////////////////////////////////////////
// TestRunnerDlg dialog
class TestRunnerDlg : public cdxCDynamicDialog,
public CPPUNIT_NS::TestListener
{
public:
TestRunnerDlg( TestRunnerModel *model,
int nDialogResourceId,
CWnd* pParent = NULL);
TestRunnerDlg( TestRunnerModel *model,
const TCHAR* szDialogResourceId = NULL,
CWnd* pParent = NULL);
virtual ~TestRunnerDlg();
// overrided from TestListener;
void startTest( CPPUNIT_NS::Test *test );
void addFailure( const CPPUNIT_NS::TestFailure &failure );
void endTest( CPPUNIT_NS::Test *test );
// IDD is not use, it is just there for the wizard.
//{{AFX_DATA(TestRunnerDlg)
CEdit m_details;
MsDevCallerListCtrl m_listCtrl;
CButton m_buttonClose;
CButton m_buttonStop;
CButton m_buttonRun;
CButton m_buttonBrowse;
BOOL m_bAutorunAtStartup;
//}}AFX_DATA
//{{AFX_VIRTUAL(TestRunnerDlg)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
protected:
//{{AFX_MSG(TestRunnerDlg)
virtual BOOL OnInitDialog();
afx_msg void OnRun();
afx_msg void OnStop();
virtual void OnOK();
afx_msg void OnBrowseTest();
afx_msg void OnQuitApplication();
afx_msg void OnClose();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnSelectedFailureChange(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnSelectTestInHistoryCombo();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
typedef std::vector<CPPUNIT_NS::Test *> Tests;
ProgressBar *m_testsProgress;
CPPUNIT_NS::Test *m_selectedTest;
ActiveTest *m_activeTest;
CPPUNIT_NS::TestResult *m_testObserver;
CPPUNIT_NS::TestResultCollector *m_result;
int m_testsRun;
int m_errors;
int m_failures;
DWORD m_testStartTime;
DWORD m_testEndTime;
static const CString ms_cppunitKey;
HACCEL m_hAccelerator;
bool m_bIsRunning;
TestRunnerModel *m_model;
CImageList m_errorListBitmap;
CFont m_fixedSizeFont;
enum ErrorTypeBitmaps
{
errorTypeFailure =0,
errorTypeError
};
void addListEntry( const CPPUNIT_NS::TestFailure &failure );
void beIdle();
void beRunning();
void beRunDisabled();
void reset();
void freeState();
void updateCountsDisplay();
void setupHistoryCombo();
CPPUNIT_NS::Test *findTestByName( std::string name ) const;
CPPUNIT_NS::Test *findTestByNameFor( const std::string &name,
CPPUNIT_NS::Test *test ) const;
void addNewTestToHistory( CPPUNIT_NS::Test *test );
void addTestToHistoryCombo( CPPUNIT_NS::Test *test,
int idx =-1 );
void removeTestFromHistory( CPPUNIT_NS::Test *test );
CComboBox *getHistoryCombo();
void updateSelectedItem();
void saveHistory();
void loadSettings();
void saveSettings();
TestRunnerModel &model();
void updateHistoryCombo();
void displayFailureDetailsFor( unsigned int failureIndex );
CRect getItemWindowRect( unsigned int itemId );
CRect getItemClientRect( unsigned int itemId );
//CRect getDialogBounds();
virtual void initializeLayout();
void updateListColumnSize();
void initializeFixedSizeFont();
private:
TestRunnerModel::Settings m_settings;
/// do all initialization, that is usually done in the constructor, so that the
/// code is not duplicated in the two constructors
void TestRunnerDlg::init(TestRunnerModel *model);
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_TESTRUNNERDLG_H)
|