Replace wxScopedPtr with std::unique_ptr in the tests

Just use the standard class instead of the wx one, as they can be used
in exactly the same way.
This commit is contained in:
Vadim Zeitlin 2023-03-06 23:34:44 +01:00
parent 29a97bb52d
commit 363f0988cf
34 changed files with 185 additions and 152 deletions

View file

@ -18,11 +18,12 @@
#endif // WX_PRECOMP
#include "wx/xml/xml.h"
#include "wx/scopedptr.h"
#include "wx/sstream.h"
#include <stdarg.h>
#include <memory>
// ----------------------------------------------------------------------------
// helpers for testing XML tree
// ----------------------------------------------------------------------------
@ -107,7 +108,7 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( XmlTestCase, "XmlTestCase" );
void XmlTestCase::InsertChild()
{
wxScopedPtr<wxXmlNode> root(new wxXmlNode(wxXML_ELEMENT_NODE, "root"));
std::unique_ptr<wxXmlNode> root(new wxXmlNode(wxXML_ELEMENT_NODE, "root"));
root->AddChild(new wxXmlNode(wxXML_ELEMENT_NODE, "1"));
wxXmlNode *two = new wxXmlNode(wxXML_ELEMENT_NODE, "2");
root->AddChild(two);
@ -127,7 +128,7 @@ void XmlTestCase::InsertChild()
void XmlTestCase::InsertChildAfter()
{
wxScopedPtr<wxXmlNode> root(new wxXmlNode(wxXML_ELEMENT_NODE, "root"));
std::unique_ptr<wxXmlNode> root(new wxXmlNode(wxXML_ELEMENT_NODE, "root"));
root->InsertChildAfter(new wxXmlNode(wxXML_ELEMENT_NODE, "1"), nullptr);
CheckXml(root.get(), "1", nullptr);

View file

@ -22,7 +22,6 @@
#include "wx/fs_inet.h"
#include "wx/imagxpm.h"
#include "wx/xml/xml.h"
#include "wx/scopedptr.h"
#include "wx/sstream.h"
#include "wx/wfstream.h"
#include "wx/xrc/xmlres.h"
@ -30,6 +29,8 @@
#include <stdarg.h>
#include <memory>
#include "testfile.h"
// ----------------------------------------------------------------------------
@ -44,7 +45,7 @@ static const char *TEST_XRC_FILE = "test.xrc";
void LoadXrcFrom(const wxString& xrcText)
{
wxStringInputStream sis(xrcText);
wxScopedPtr<wxXmlDocument> xmlDoc(new wxXmlDocument(sis, "UTF-8"));
std::unique_ptr<wxXmlDocument> xmlDoc(new wxXmlDocument(sis, "UTF-8"));
REQUIRE( xmlDoc->IsOk() );
// Load the xrc we've just created