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

« back to all changes in this revision

Viewing changes to lib/cppunit-1.10.0/examples/msvc6/HostApp/HostApp.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
// HostApp.cpp : Defines the class behaviors for the application.
 
2
//
 
3
 
 
4
#include "stdafx.h"
 
5
#include "HostApp.h"
 
6
 
 
7
#include "MainFrm.h"
 
8
#include "HostAppDoc.h"
 
9
#include "HostAppView.h"
 
10
 
 
11
// CppUnit: MFC TestRunner
 
12
#include <cppunit/ui/mfc/TestRunner.h>
 
13
// CppUnit: TestFactoryRegistry to retreive the top test suite that contains all registered tests.
 
14
#include <cppunit/extensions/TestFactoryRegistry.h>
 
15
 
 
16
#ifdef _DEBUG
 
17
#define new DEBUG_NEW
 
18
#undef THIS_FILE
 
19
static char THIS_FILE[] = __FILE__;
 
20
#endif
 
21
 
 
22
static AFX_EXTENSION_MODULE  extTestRunner;
 
23
 
 
24
/////////////////////////////////////////////////////////////////////////////
 
25
// CHostAppApp
 
26
 
 
27
BEGIN_MESSAGE_MAP(CHostAppApp, CWinApp)
 
28
    //{{AFX_MSG_MAP(CHostAppApp)
 
29
    ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
 
30
        // NOTE - the ClassWizard will add and remove mapping macros here.
 
31
        //    DO NOT EDIT what you see in these blocks of generated code!
 
32
    //}}AFX_MSG_MAP
 
33
    // Standard file based document commands
 
34
    ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
 
35
    ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
 
36
    // Standard print setup command
 
37
    ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
 
38
END_MESSAGE_MAP()
 
39
 
 
40
/////////////////////////////////////////////////////////////////////////////
 
41
// CHostAppApp construction
 
42
 
 
43
CHostAppApp::CHostAppApp()
 
44
{
 
45
    // TODO: add construction code here,
 
46
    // Place all significant initialization in InitInstance
 
47
}
 
48
 
 
49
/////////////////////////////////////////////////////////////////////////////
 
50
// The one and only CHostAppApp object
 
51
 
 
52
CHostAppApp theApp;
 
53
 
 
54
/////////////////////////////////////////////////////////////////////////////
 
55
// CHostAppApp initialization
 
56
 
 
57
BOOL CHostAppApp::InitInstance()
 
58
{
 
59
    // Standard initialization
 
60
    // If you are not using these features and wish to reduce the size
 
61
    //  of your final executable, you should remove from the following
 
62
    //  the specific initialization routines you do not need.
 
63
 
 
64
#ifdef _AFXDLL
 
65
# if _MSC_VER < 1300   // vc6
 
66
        Enable3dControls();                     // Call this when using MFC in a shared DLL
 
67
# endif
 
68
#else
 
69
    Enable3dControlsStatic();   // Call this when linking to MFC statically
 
70
#endif
 
71
 
 
72
    // Change the registry key under which our settings are stored.
 
73
    // You should modify this string to be something appropriate
 
74
    // such as the name of your company or organization.
 
75
    SetRegistryKey(_T("Local AppWizard-Generated Applications"));
 
76
 
 
77
    LoadStdProfileSettings();  // Load standard INI file options (including MRU)
 
78
 
 
79
    // Register the application's document templates.  Document templates
 
80
    //  serve as the connection between documents, frame windows and views.
 
81
 
 
82
    CSingleDocTemplate* pDocTemplate;
 
83
    pDocTemplate = new CSingleDocTemplate(
 
84
        IDR_MAINFRAME,
 
85
        RUNTIME_CLASS(CHostAppDoc),
 
86
        RUNTIME_CLASS(CMainFrame),       // main SDI frame window
 
87
        RUNTIME_CLASS(CHostAppView));
 
88
    AddDocTemplate(pDocTemplate);
 
89
 
 
90
    RunUnitTests();
 
91
 
 
92
/*
 
93
    // Parse command line for standard shell commands, DDE, file open
 
94
    CCommandLineInfo cmdInfo;
 
95
    ParseCommandLine(cmdInfo);
 
96
 
 
97
    // Dispatch commands specified on the command line
 
98
    if (!ProcessShellCommand(cmdInfo))
 
99
        return FALSE;
 
100
 
 
101
    // The one and only window has been initialized, so show and update it.
 
102
    m_pMainWnd->ShowWindow(SW_SHOW);
 
103
    m_pMainWnd->UpdateWindow();
 
104
*/
 
105
 
 
106
    return TRUE;
 
107
}
 
108
 
 
109
 
 
110
void 
 
111
CHostAppApp::RunUnitTests()
 
112
{
 
113
  CPPUNIT_NS::MfcUi::TestRunner runner;
 
114
  runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
 
115
 
 
116
  runner.run();    
 
117
}
 
118
 
 
119
 
 
120
/////////////////////////////////////////////////////////////////////////////
 
121
// CAboutDlg dialog used for App About
 
122
 
 
123
class CAboutDlg : public CDialog
 
124
{
 
125
public:
 
126
    CAboutDlg();
 
127
 
 
128
// Dialog Data
 
129
    //{{AFX_DATA(CAboutDlg)
 
130
    enum { IDD = IDD_ABOUTBOX };
 
131
    //}}AFX_DATA
 
132
 
 
133
    // ClassWizard generated virtual function overrides
 
134
    //{{AFX_VIRTUAL(CAboutDlg)
 
135
    protected:
 
136
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
 
137
    //}}AFX_VIRTUAL
 
138
 
 
139
// Implementation
 
140
protected:
 
141
    //{{AFX_MSG(CAboutDlg)
 
142
        // No message handlers
 
143
    //}}AFX_MSG
 
144
    DECLARE_MESSAGE_MAP()
 
145
};
 
146
 
 
147
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
 
148
{
 
149
    //{{AFX_DATA_INIT(CAboutDlg)
 
150
    //}}AFX_DATA_INIT
 
151
}
 
152
 
 
153
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
 
154
{
 
155
    CDialog::DoDataExchange(pDX);
 
156
    //{{AFX_DATA_MAP(CAboutDlg)
 
157
    //}}AFX_DATA_MAP
 
158
}
 
159
 
 
160
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
 
161
    //{{AFX_MSG_MAP(CAboutDlg)
 
162
        // No message handlers
 
163
    //}}AFX_MSG_MAP
 
164
END_MESSAGE_MAP()
 
165
 
 
166
// App command to run the dialog
 
167
void CHostAppApp::OnAppAbout()
 
168
{
 
169
    CAboutDlg aboutDlg;
 
170
    aboutDlg.DoModal();
 
171
}
 
172
 
 
173
/////////////////////////////////////////////////////////////////////////////
 
174
// CHostAppApp commands