]> git.saurik.com Git - wxWidgets.git/commitdiff
Add ClearEventCount to wxTestableFrame. This means we can clear an event count when...
authorSteve Lamerton <steve.lamerton@gmail.com>
Thu, 23 Sep 2010 16:55:29 +0000 (16:55 +0000)
committerSteve Lamerton <steve.lamerton@gmail.com>
Thu, 23 Sep 2010 16:55:29 +0000 (16:55 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65596 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

tests/testableframe.cpp
tests/testableframe.h

index efa7396f267dcc6cd22cc2d7c4aa7edb923beff0..d69be423ebef1686d6b5ff6fa78a1d80815d1c7d 100644 (file)
@@ -2,7 +2,7 @@
 // Name:        testableframe.cpp
 // Purpose:     An improved wxFrame for unit-testing
 // Author:      Steven Lamerton
-// RCS-ID:      $Id:$
+// RCS-ID:      $Id$
 // Copyright:   (c) 2010 Steven Lamerton
 // Licence:     wxWidgets licence
 ///////////////////////////////////////////////////////////////////////////////
@@ -54,6 +54,11 @@ int wxTestableFrame::GetEventCount(wxEventType type)
     }
 }
 
+void wxTestableFrame::ClearEventCount(wxEventType type)
+{
+    m_count[type] = 0;
+}
+
 EventCounter::EventCounter(wxWindow* win, wxEventType type) : m_type(type),
                                                               m_win(win)
 
@@ -74,6 +79,9 @@ EventCounter::~EventCounter()
                       NULL,
                       m_frame);
 
+    //This stops spurious counts from previous tests
+    m_frame->ClearEventCount(m_type);
+
     m_frame = NULL;
     m_win = NULL;
 }
index ad676a12fcbb572c93527328e5f8f2fc2aac40d1..1e0fa2131826c06237dba15a117389d951b98b8b 100644 (file)
@@ -2,7 +2,7 @@
 // Name:        testableframe.h
 // Purpose:     An improved wxFrame for unit-testing
 // Author:      Steven Lamerton
-// RCS-ID:      $Id:$
+// RCS-ID:      $Id$
 // Copyright:   (c) 2010 Steven Lamerton
 // Licence:     wxWidgets licence
 ///////////////////////////////////////////////////////////////////////////////
@@ -21,6 +21,9 @@ public:
     //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;
 };