From c67e689bb518b735001e2d885cc51098b8cdbbed Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 23 Apr 2021 21:45:35 +0200 Subject: [PATCH] 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. --- tests/controls/spinctrldbltest.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/controls/spinctrldbltest.cpp b/tests/controls/spinctrldbltest.cpp index 890659b298..a4fe967942 100644 --- a/tests/controls/spinctrldbltest.cpp +++ b/tests/controls/spinctrldbltest.cpp @@ -17,6 +17,7 @@ #include "testableframe.h" #include "wx/uiaction.h" +#include "wx/scopedptr.h" #include "wx/spinctrl.h" class SpinCtrlDoubleTestCase @@ -54,10 +55,10 @@ TEST_CASE("SpinCtrlDouble::NoEventsInCtor", "[spinctrl][spinctrldouble]") { // Verify that creating the control does not generate any events. This is // unexpected and shouldn't happen. - wxSpinCtrlDouble *m_spin = new wxSpinCtrlDouble; + wxScopedPtr m_spin(new wxSpinCtrlDouble); - EventCounter updatedSpin(m_spin, wxEVT_SPINCTRLDOUBLE); - EventCounter updatedText(m_spin, wxEVT_TEXT); + EventCounter updatedSpin(m_spin.get(), wxEVT_SPINCTRLDOUBLE); + EventCounter updatedText(m_spin.get(), wxEVT_TEXT); m_spin->Create(wxTheApp->GetTopWindow(), wxID_ANY, "", wxDefaultPosition, wxDefaultSize, 0,