]>
Commit | Line | Data |
---|---|---|
232fdc63 VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: testableframe.h | |
3 | // Purpose: An improved wxFrame for unit-testing | |
4 | // Author: Steven Lamerton | |
232fdc63 | 5 | // Copyright: (c) 2010 Steven Lamerton |
3fdcd5d5 | 6 | // Licence: wxWindows licence |
232fdc63 VZ |
7 | /////////////////////////////////////////////////////////////////////////////// |
8 | ||
9 | #include "wx/frame.h" | |
10 | #include "wx/hashmap.h" | |
11 | #include "wx/event.h" | |
12 | ||
13 | class wxTestableFrame : public wxFrame | |
14 | { | |
15 | public: | |
16 | wxTestableFrame(); | |
17 | ||
18 | void OnEvent(wxEvent& evt); | |
19 | ||
744d91d4 SL |
20 | private: |
21 | friend class EventCounter; | |
232fdc63 | 22 | |
744d91d4 | 23 | int GetEventCount(wxEventType type); |
4ceca854 SL |
24 | void ClearEventCount(wxEventType type); |
25 | ||
232fdc63 VZ |
26 | wxLongToLongHashMap m_count; |
27 | }; | |
28 | ||
29 | class EventCounter | |
30 | { | |
31 | public: | |
32 | EventCounter(wxWindow* win, wxEventType type); | |
33 | ~EventCounter(); | |
34 | ||
744d91d4 SL |
35 | int GetCount() { return m_frame->GetEventCount(m_type); } |
36 | void Clear() { m_frame->ClearEventCount(m_type); } | |
37 | ||
232fdc63 VZ |
38 | private: |
39 | wxEventType m_type; | |
40 | wxTestableFrame* m_frame; | |
41 | wxWindow* m_win; | |
42 | }; |