Fix deleting of wxTextCtrl in wxNumValidator test case

This was broken in da973c3caf (Get rid of CppUnit boilerplate in numeric
validator unit tests, 2021-02-21) which replaced DestroyChildren() in
the old CppUnit test case dtor with just "delete m_text", as this didn't
take care of "text2" created in one of the tests.

Using DestroyChildren() still seems overly side, so ensure that "text2"
is destroyed explicitly.
This commit is contained in:
Vadim Zeitlin
2021-02-22 14:26:23 +01:00
parent bdaca38904
commit 72a24b402b

View File

@@ -20,6 +20,8 @@
#include "asserthelper.h"
#include "testableframe.h"
#include "wx/scopeguard.h"
#include "wx/uiaction.h"
class NumValidatorTestCase
@@ -243,6 +245,7 @@ TEST_CASE_METHOD(NumValidatorTestCase, "ValNum::Interactive", "[valnum]")
// Create a sibling text control to be able to switch focus and thus
// trigger the control validation/normalization.
wxTextCtrl * const text2 = new wxTextCtrl(m_text->GetParent(), wxID_ANY);
wxON_BLOCK_EXIT_OBJ0( *text2, wxWindow::Destroy );
text2->Move(10, 80); // Just to see it better while debugging...
wxFloatingPointValidator<float> valFloat(3);
valFloat.SetRange(-10., 10.);