744d91d41f
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70871 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
44 lines
1020 B
C++
44 lines
1020 B
C++
///////////////////////////////////////////////////////////////////////////////
|
|
// Name: testableframe.h
|
|
// Purpose: An improved wxFrame for unit-testing
|
|
// Author: Steven Lamerton
|
|
// RCS-ID: $Id$
|
|
// Copyright: (c) 2010 Steven Lamerton
|
|
// Licence: wxWindows licence
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "wx/frame.h"
|
|
#include "wx/hashmap.h"
|
|
#include "wx/event.h"
|
|
|
|
class wxTestableFrame : public wxFrame
|
|
{
|
|
public:
|
|
wxTestableFrame();
|
|
|
|
void OnEvent(wxEvent& evt);
|
|
|
|
private:
|
|
friend class EventCounter;
|
|
|
|
int GetEventCount(wxEventType type);
|
|
void ClearEventCount(wxEventType type);
|
|
|
|
wxLongToLongHashMap m_count;
|
|
};
|
|
|
|
class EventCounter
|
|
{
|
|
public:
|
|
EventCounter(wxWindow* win, wxEventType type);
|
|
~EventCounter();
|
|
|
|
int GetCount() { return m_frame->GetEventCount(m_type); }
|
|
void Clear() { m_frame->ClearEventCount(m_type); }
|
|
|
|
private:
|
|
wxEventType m_type;
|
|
wxTestableFrame* m_frame;
|
|
wxWindow* m_win;
|
|
};
|