-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnitTest.h
More file actions
141 lines (115 loc) · 4.82 KB
/
UnitTest.h
File metadata and controls
141 lines (115 loc) · 4.82 KB
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
/***************************************************************
* Name: UnitTestPlugin
* Purpose: Code::Blocks plugin
* Author: ()
* Created: 2014-02-15
* Copyright:
* License: GPL
**************************************************************/
#ifndef UNITTEST_H_INCLUDED
#define UNITTEST_H_INCLUDED
// For compilers that support precompilation, includes <wx/wx.h>
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/thread.h>
#include <wx/wx.h>
#endif
#include <cbplugin.h> // for "class cbPlugin"
const long ID_MENU_RUNTEST = wxNewId();
const long ID_MENU_RUNSUITE = wxNewId();
const long ID_MENU_RUNALL = wxNewId();
class TestOutputLog;
class UnitTestProcess;
class OutputReader;
class TextCtrlLogger;
class UnitTest : public cbPlugin
{
public:
UnitTest();
virtual ~UnitTest();
void OnOutput(const wxString &line);
void OnRunTest(wxCommandEvent &WXUNUSED(event));
void OnRunSuite(wxCommandEvent &WXUNUSED(event));
void OnRunAllTests(wxCommandEvent &WXUNUSED(event));
// getter
UnitTestProcess *GetProcess() { return m_Process; }
private:
DECLARE_EVENT_TABLE();
UnitTestProcess *m_Process;
OutputReader *m_OutputReader;
TextCtrlLogger *m_OutputLog;
TestOutputLog *m_OutputListLog;
int m_OutputLogPageIndex;
int m_OutputListLogPageIndex;
bool m_SwitchedToOutput;
bool m_SwitchedToOutputList;
wxString m_CommandLineArguments;
void RunTests(const wxString &commandLine);
// compiling if not up to date
cbCompilerPlugin *m_CompilerPlugin;
bool m_WaitingCompilerToFinish;
void EnsureBuildUpToDate();
void OnCompilerFinished(cb_unused CodeBlocksEvent &event);
// process management
int LaunchTestProcess();
bool IsTestProcessRunning() const;
void KillTestProcess();
public:
void OnTestRunFinished();
/** This method is called by Code::Blocks and is used by the plugin
* to add any menu items it needs on Code::Blocks's menu bar.\n
* It is a pure virtual method that needs to be implemented by all
* plugins. If the plugin does not need to add items on the menu,
* just do nothing ;)
* @param menuBar the wxMenuBar to create items in
*/
virtual void BuildMenu(wxMenuBar *menuBar);
/** This method is called by Code::Blocks core modules (EditorManager,
* ProjectManager etc) and is used by the plugin to add any menu
* items it needs in the module's popup menu. For example, when
* the user right-clicks on a project file in the project tree,
* ProjectManager prepares a popup menu to display with context
* sensitive options for that file. Before it displays this popup
* menu, it asks all attached plugins (by asking PluginManager to call
* this method), if they need to add any entries
* in that menu. This method is called.\n
* If the plugin does not need to add items in the menu,
* just do nothing ;)
* @param type the module that's preparing a popup menu
* @param menu pointer to the popup menu
* @param data pointer to FileTreeData object (to access/modify the file tree)
*/
virtual void BuildModuleMenu(const ModuleType type, wxMenu *menu, const FileTreeData *data = 0);
/** This method is called by Code::Blocks and is used by the plugin
* to add any toolbar items it needs on Code::Blocks's toolbar.\n
* It is a pure virtual method that needs to be implemented by all
* plugins. If the plugin does not need to add items on the toolbar,
* just do nothing ;)
* @param toolBar the wxToolBar to create items on
* @return The plugin should return true if it needed the toolbar, false if not
*/
virtual bool BuildToolBar(wxToolBar *toolBar);
protected:
/** Any descendent plugin should override this virtual method and
* perform any necessary initialization. This method is called by
* Code::Blocks (PluginManager actually) when the plugin has been
* loaded and should attach in Code::Blocks. When Code::Blocks
* starts up, it finds and <em>loads</em> all plugins but <em>does
* not</em> activate (attaches) them. It then activates all plugins
* that the user has selected to be activated on start-up.\n
* This means that a plugin might be loaded but <b>not</b> activated...\n
* Think of this method as the actual constructor...
*/
virtual void OnAttach();
/** Any descendent plugin should override this virtual method and
* perform any necessary de-initialization. This method is called by
* Code::Blocks (PluginManager actually) when the plugin has been
* loaded, attached and should de-attach from Code::Blocks.\n
* Think of this method as the actual destructor...
* @param appShutDown If true, the application is shutting down. In this
* case *don't* use Manager::Get()->Get...() functions or the
* behaviour is undefined...
*/
virtual void OnRelease(bool appShutDown);
};
#endif // UNITTEST_H_INCLUDED