]> git.saurik.com Git - wxWidgets.git/blame - tests/testableframe.h
Use wxCOMPtr throughout wxWebViewIE to simplify the code and reduce the chance of...
[wxWidgets.git] / tests / testableframe.h
CommitLineData
232fdc63
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: testableframe.h
3// Purpose: An improved wxFrame for unit-testing
4// Author: Steven Lamerton
4ceca854 5// RCS-ID: $Id$
232fdc63 6// Copyright: (c) 2010 Steven Lamerton
3fdcd5d5 7// Licence: wxWindows licence
232fdc63
VZ
8///////////////////////////////////////////////////////////////////////////////
9
10#include "wx/frame.h"
11#include "wx/hashmap.h"
12#include "wx/event.h"
13
14class wxTestableFrame : public wxFrame
15{
16public:
17 wxTestableFrame();
18
19 void OnEvent(wxEvent& evt);
20
744d91d4
SL
21private:
22 friend class EventCounter;
232fdc63 23
744d91d4 24 int GetEventCount(wxEventType type);
4ceca854
SL
25 void ClearEventCount(wxEventType type);
26
232fdc63
VZ
27 wxLongToLongHashMap m_count;
28};
29
30class EventCounter
31{
32public:
33 EventCounter(wxWindow* win, wxEventType type);
34 ~EventCounter();
35
744d91d4
SL
36 int GetCount() { return m_frame->GetEventCount(m_type); }
37 void Clear() { m_frame->ClearEventCount(m_type); }
38
232fdc63
VZ
39private:
40 wxEventType m_type;
41 wxTestableFrame* m_frame;
42 wxWindow* m_win;
43};