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:
@@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
#include "asserthelper.h"
|
#include "asserthelper.h"
|
||||||
#include "testableframe.h"
|
#include "testableframe.h"
|
||||||
|
|
||||||
|
#include "wx/scopeguard.h"
|
||||||
#include "wx/uiaction.h"
|
#include "wx/uiaction.h"
|
||||||
|
|
||||||
class NumValidatorTestCase
|
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
|
// Create a sibling text control to be able to switch focus and thus
|
||||||
// trigger the control validation/normalization.
|
// trigger the control validation/normalization.
|
||||||
wxTextCtrl * const text2 = new wxTextCtrl(m_text->GetParent(), wxID_ANY);
|
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...
|
text2->Move(10, 80); // Just to see it better while debugging...
|
||||||
wxFloatingPointValidator<float> valFloat(3);
|
wxFloatingPointValidator<float> valFloat(3);
|
||||||
valFloat.SetRange(-10., 10.);
|
valFloat.SetRange(-10., 10.);
|
||||||
|
Reference in New Issue
Block a user