git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65596
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
// Name: testableframe.cpp
// Purpose: An improved wxFrame for unit-testing
// Author: Steven Lamerton
// Name: testableframe.cpp
// Purpose: An improved wxFrame for unit-testing
// Author: Steven Lamerton
// Copyright: (c) 2010 Steven Lamerton
// Licence: wxWidgets licence
///////////////////////////////////////////////////////////////////////////////
// Copyright: (c) 2010 Steven Lamerton
// Licence: wxWidgets licence
///////////////////////////////////////////////////////////////////////////////
+void wxTestableFrame::ClearEventCount(wxEventType type)
+{
+ m_count[type] = 0;
+}
+
EventCounter::EventCounter(wxWindow* win, wxEventType type) : m_type(type),
m_win(win)
EventCounter::EventCounter(wxWindow* win, wxEventType type) : m_type(type),
m_win(win)
+ //This stops spurious counts from previous tests
+ m_frame->ClearEventCount(m_type);
+
m_frame = NULL;
m_win = NULL;
}
m_frame = NULL;
m_win = NULL;
}
// Name: testableframe.h
// Purpose: An improved wxFrame for unit-testing
// Author: Steven Lamerton
// Name: testableframe.h
// Purpose: An improved wxFrame for unit-testing
// Author: Steven Lamerton
// Copyright: (c) 2010 Steven Lamerton
// Licence: wxWidgets licence
///////////////////////////////////////////////////////////////////////////////
// Copyright: (c) 2010 Steven Lamerton
// Licence: wxWidgets licence
///////////////////////////////////////////////////////////////////////////////
//wxEVT_ANY get the count for all events or a type can be specified
int GetEventCount(wxEventType type = wxEVT_ANY);
//wxEVT_ANY get the count for all events or a type can be specified
int GetEventCount(wxEventType type = wxEVT_ANY);
+ //Used to clear an event count, after disconnecting a counter for example
+ void ClearEventCount(wxEventType type);
+
private:
wxLongToLongHashMap m_count;
};
private:
wxLongToLongHashMap m_count;
};