Fix left over control in wxSpinCtrlDouble unit tests

Fix the bug introduced in the recent 34ab87ce4d (Get rid of CppUnit
boilerplate in wxSpinCtrlDouble unit test, 2021-04-19) which resulted in
failures in the subsequent unit tests and ensure that the spin control
is destroyed at the end of the test.
This commit is contained in:
Vadim Zeitlin
2021-04-23 21:45:35 +02:00
parent 3fc404372f
commit c67e689bb5

View File

@@ -17,6 +17,7 @@
#include "testableframe.h" #include "testableframe.h"
#include "wx/uiaction.h" #include "wx/uiaction.h"
#include "wx/scopedptr.h"
#include "wx/spinctrl.h" #include "wx/spinctrl.h"
class SpinCtrlDoubleTestCase class SpinCtrlDoubleTestCase
@@ -54,10 +55,10 @@ TEST_CASE("SpinCtrlDouble::NoEventsInCtor", "[spinctrl][spinctrldouble]")
{ {
// Verify that creating the control does not generate any events. This is // Verify that creating the control does not generate any events. This is
// unexpected and shouldn't happen. // unexpected and shouldn't happen.
wxSpinCtrlDouble *m_spin = new wxSpinCtrlDouble; wxScopedPtr<wxSpinCtrlDouble> m_spin(new wxSpinCtrlDouble);
EventCounter updatedSpin(m_spin, wxEVT_SPINCTRLDOUBLE); EventCounter updatedSpin(m_spin.get(), wxEVT_SPINCTRLDOUBLE);
EventCounter updatedText(m_spin, wxEVT_TEXT); EventCounter updatedText(m_spin.get(), wxEVT_TEXT);
m_spin->Create(wxTheApp->GetTopWindow(), wxID_ANY, "", m_spin->Create(wxTheApp->GetTopWindow(), wxID_ANY, "",
wxDefaultPosition, wxDefaultSize, 0, wxDefaultPosition, wxDefaultSize, 0,