]> git.saurik.com Git - wxWidgets.git/blob - tests/testableframe.h
Fix configure check for gcc atomics on 32-bit x86.
[wxWidgets.git] / tests / testableframe.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: testableframe.h
3 // Purpose: An improved wxFrame for unit-testing
4 // Author: Steven Lamerton
5 // Copyright: (c) 2010 Steven Lamerton
6 // Licence: wxWindows licence
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
20 private:
21 friend class EventCounter;
22
23 int GetEventCount(wxEventType type);
24 void ClearEventCount(wxEventType type);
25
26 wxLongToLongHashMap m_count;
27 };
28
29 class EventCounter
30 {
31 public:
32 EventCounter(wxWindow* win, wxEventType type);
33 ~EventCounter();
34
35 int GetCount() { return m_frame->GetEventCount(m_type); }
36 void Clear() { m_frame->ClearEventCount(m_type); }
37
38 private:
39 wxEventType m_type;
40 wxTestableFrame* m_frame;
41 wxWindow* m_win;
42 };