diff --git a/tests/menu/accelentry.cpp b/tests/menu/accelentry.cpp index 0f809da446..652c594b69 100644 --- a/tests/menu/accelentry.cpp +++ b/tests/menu/accelentry.cpp @@ -17,6 +17,7 @@ #endif // WX_PRECOMP #include "wx/accel.h" +#include "wx/scopedptr.h" namespace { @@ -35,11 +36,11 @@ void CheckAccelEntry(const wxAcceleratorEntry& accel, int keycode, int flags) */ TEST_CASE( "wxAcceleratorEntry::Create", "[accelentry]" ) { - wxAcceleratorEntry* pa; + wxScopedPtr pa; SECTION( "Correct behavior" ) { - pa = wxAcceleratorEntry::Create("Foo\tCtrl+Z"); + pa.reset( wxAcceleratorEntry::Create("Foo\tCtrl+Z") ); CHECK( pa ); CHECK( pa->IsOk() ); @@ -48,21 +49,21 @@ TEST_CASE( "wxAcceleratorEntry::Create", "[accelentry]" ) SECTION( "Tab missing" ) { - pa = wxAcceleratorEntry::Create("Shift-Q"); + pa.reset( wxAcceleratorEntry::Create("Shift-Q") ); CHECK( !pa ); } SECTION( "No accelerator key specified" ) { - pa = wxAcceleratorEntry::Create("bloordyblop"); + pa.reset( wxAcceleratorEntry::Create("bloordyblop") ); CHECK( !pa ); } SECTION( "Display name parsing" ) { - pa = wxAcceleratorEntry::Create("Test\tBackSpace"); + pa.reset( wxAcceleratorEntry::Create("Test\tBackSpace") ); CHECK( pa ); CHECK( pa->IsOk() ); diff --git a/tests/menu/menu.cpp b/tests/menu/menu.cpp index a99b053767..6ce4a58664 100644 --- a/tests/menu/menu.cpp +++ b/tests/menu/menu.cpp @@ -20,6 +20,7 @@ #endif // WX_PRECOMP #include "wx/menu.h" +#include "wx/scopedptr.h" #include "wx/translation.h" #include "wx/uiaction.h" @@ -624,7 +625,9 @@ namespace void VerifyAccelAssigned( wxString labelText, int keycode ) { - wxAcceleratorEntry* entry = wxAcceleratorEntry::Create( labelText ); + const wxScopedPtr entry( + wxAcceleratorEntry::Create( labelText ) + ); CHECK( entry ); CHECK( entry->GetKeyCode() == keycode );