diff --git a/tests/archive/archivetest.cpp b/tests/archive/archivetest.cpp index 3a8a318b0b..09b40ff155 100644 --- a/tests/archive/archivetest.cpp +++ b/tests/archive/archivetest.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include using std::string; @@ -537,7 +538,7 @@ TestEntry& ArchiveTestCase::Add(const char *name, template void ArchiveTestCase::CreateArchive(wxOutputStream& out) { - wxScopedPtr arc(m_factory->NewStream(out)); + std::unique_ptr arc(m_factory->NewStream(out)); TestEntries::iterator it; OnCreateArchive(*arc); @@ -565,7 +566,7 @@ void ArchiveTestCase::CreateArchive(wxOutputStream& out) if ((choices & 2) || testEntry.IsText()) { // try PutNextEntry(EntryT *pEntry) - wxScopedPtr entry(m_factory->NewEntry()); + std::unique_ptr entry(m_factory->NewEntry()); entry->SetName(name, wxPATH_UNIX); if (setIsDir) entry->SetIsDir(); @@ -681,8 +682,8 @@ template void ArchiveTestCase::ModifyArchive(wxInputStream& in, wxOutputStream& out) { - wxScopedPtr arcIn(m_factory->NewStream(in)); - wxScopedPtr arcOut(m_factory->NewStream(out)); + std::unique_ptr arcIn(m_factory->NewStream(in)); + std::unique_ptr arcOut(m_factory->NewStream(out)); EntryT *pEntry; const wxString deleteName = wxT("bin/bin1000"); @@ -694,7 +695,7 @@ void ArchiveTestCase::ModifyArchive(wxInputStream& in, arcOut->CopyArchiveMetaData(*arcIn); while ((pEntry = arcIn->GetNextEntry()) != nullptr) { - wxScopedPtr entry(pEntry); + std::unique_ptr entry(pEntry); OnSetNotifier(*entry); wxString name = entry->GetName(wxPATH_UNIX); @@ -739,7 +740,7 @@ void ArchiveTestCase::ModifyArchive(wxInputStream& in, // try adding a new entry TestEntry& testEntry = Add(newName.mb_str(), newData); - wxScopedPtr newentry(m_factory->NewEntry()); + std::unique_ptr newentry(m_factory->NewEntry()); newentry->SetName(newName); newentry->SetDateTime(testEntry.GetDateTime()); newentry->SetSize(testEntry.GetLength()); @@ -762,7 +763,7 @@ void ArchiveTestCase::ExtractArchive(wxInputStream& in) typedef std::list Entries; typedef typename Entries::iterator EntryIter; - wxScopedPtr arc(m_factory->NewStream(in)); + std::unique_ptr arc(m_factory->NewStream(in)); int expectedTotal = m_testEntries.size(); EntryPtr entry; Entries entries; @@ -973,13 +974,13 @@ void ArchiveTestCase::TestIterator(wxInputStream& in) typedef std::list ArchiveCatalog; typedef typename ArchiveCatalog::iterator CatalogIter; - wxScopedPtr arc(m_factory->NewStream(in)); + std::unique_ptr arc(m_factory->NewStream(in)); size_t count = 0; ArchiveCatalog cat((IterT)*arc, IterT()); for (CatalogIter it = cat.begin(); it != cat.end(); ++it) { - wxScopedPtr entry(*it); + std::unique_ptr entry(*it); count += m_testEntries.count(entry->GetName(wxPATH_UNIX)); } @@ -996,13 +997,13 @@ void ArchiveTestCase::TestPairIterator(wxInputStream& in) typedef std::map ArchiveCatalog; typedef typename ArchiveCatalog::iterator CatalogIter; - wxScopedPtr arc(m_factory->NewStream(in)); + std::unique_ptr arc(m_factory->NewStream(in)); size_t count = 0; ArchiveCatalog cat((PairIterT)*arc, PairIterT()); for (CatalogIter it = cat.begin(); it != cat.end(); ++it) { - wxScopedPtr entry(it->second); + std::unique_ptr entry(it->second); count += m_testEntries.count(entry->GetName(wxPATH_UNIX)); } @@ -1019,7 +1020,7 @@ void ArchiveTestCase::TestSmartIterator(wxInputStream& in) typedef typename ArchiveCatalog::iterator CatalogIter; typedef wxArchiveIterator > Iter; - wxScopedPtr arc(m_factory->NewStream(in)); + std::unique_ptr arc(m_factory->NewStream(in)); ArchiveCatalog cat((Iter)*arc, Iter()); @@ -1039,7 +1040,7 @@ void ArchiveTestCase::TestSmartPairIterator(wxInputStream& in) typedef wxArchiveIterator > > PairIter; - wxScopedPtr arc(m_factory->NewStream(in)); + std::unique_ptr arc(m_factory->NewStream(in)); ArchiveCatalog cat((PairIter)*arc, PairIter()); @@ -1060,8 +1061,8 @@ void ArchiveTestCase::ReadSimultaneous(TestInputStream& in) // create two archive input streams TestInputStream in2(in); - wxScopedPtr arc(m_factory->NewStream(in)); - wxScopedPtr arc2(m_factory->NewStream(in2)); + std::unique_ptr arc(m_factory->NewStream(in)); + std::unique_ptr arc2(m_factory->NewStream(in2)); // load the catalog ArchiveCatalog cat((PairIter)*arc, PairIter()); @@ -1147,7 +1148,7 @@ protected: void CreateArchive(wxOutputStream& out); void ExtractArchive(wxInputStream& in); - wxScopedPtr m_factory; // factory to make classes + std::unique_ptr m_factory; // factory to make classes int m_options; // test options }; @@ -1187,7 +1188,7 @@ void CorruptionTestCase::runTest() void CorruptionTestCase::CreateArchive(wxOutputStream& out) { - wxScopedPtr arc(m_factory->NewStream(out)); + std::unique_ptr arc(m_factory->NewStream(out)); arc->PutNextDirEntry(wxT("dir")); arc->PutNextEntry(wxT("file")); @@ -1196,8 +1197,8 @@ void CorruptionTestCase::CreateArchive(wxOutputStream& out) void CorruptionTestCase::ExtractArchive(wxInputStream& in) { - wxScopedPtr arc(m_factory->NewStream(in)); - wxScopedPtr entry(arc->GetNextEntry()); + std::unique_ptr arc(m_factory->NewStream(in)); + std::unique_ptr entry(arc->GetNextEntry()); while (entry.get() != nullptr) { char buf[1024]; diff --git a/tests/archive/archivetest.h b/tests/archive/archivetest.h index a97169e830..986aae64e5 100644 --- a/tests/archive/archivetest.h +++ b/tests/archive/archivetest.h @@ -12,7 +12,6 @@ #define WX_TEST_ARCHIVE_ITERATOR #include "wx/archive.h" -#include "wx/scopedptr.h" #include "wx/wfstream.h" #include @@ -220,7 +219,7 @@ protected: typedef std::map TestEntries; TestEntries m_testEntries; // test data - wxScopedPtr m_factory; // factory to make classes + std::unique_ptr m_factory; // factory to make classes int m_options; // test options wxDateTime m_timeStamp; // timestamp to give test entries int m_id; // select between the possibilites diff --git a/tests/archive/ziptest.cpp b/tests/archive/ziptest.cpp index d544f4f201..0d10c0759a 100644 --- a/tests/archive/ziptest.cpp +++ b/tests/archive/ziptest.cpp @@ -17,6 +17,8 @@ #include "archivetest.h" #include "wx/zipstrm.h" +#include + using std::string; @@ -183,7 +185,7 @@ void ZipPipeTestCase::runTest() TestInputStream in(out, m_id % ((m_options & PipeIn) ? 4 : 3)); wxZipInputStream zip(in); - wxScopedPtr entry(zip.GetNextEntry()); + std::unique_ptr entry(zip.GetNextEntry()); CPPUNIT_ASSERT(entry.get() != nullptr); if ((m_options & PipeIn) == 0) diff --git a/tests/controls/label.cpp b/tests/controls/label.cpp index 440a9d1f06..ec72d1a3b7 100644 --- a/tests/controls/label.cpp +++ b/tests/controls/label.cpp @@ -19,11 +19,12 @@ #include "wx/checkbox.h" #include "wx/control.h" -#include "wx/scopedptr.h" #include "wx/stattext.h" #include "wx/generic/stattextg.h" +#include + namespace { @@ -90,14 +91,14 @@ TEST_CASE("wxControl::Label", "[wxControl][label]") { SECTION("wxStaticText") { - const wxScopedPtr + const std::unique_ptr st(new wxStaticText(wxTheApp->GetTopWindow(), wxID_ANY, ORIGINAL_LABEL)); DoTestLabel(st.get()); } SECTION("wxStaticText/ellipsized") { - const wxScopedPtr + const std::unique_ptr st(new wxStaticText(wxTheApp->GetTopWindow(), wxID_ANY, ORIGINAL_LABEL, wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_START)); @@ -106,14 +107,14 @@ TEST_CASE("wxControl::Label", "[wxControl][label]") SECTION("wxGenericStaticText") { - const wxScopedPtr + const std::unique_ptr gst(new wxGenericStaticText(wxTheApp->GetTopWindow(), wxID_ANY, ORIGINAL_LABEL)); DoTestLabel(gst.get()); } SECTION("wxCheckBox") { - const wxScopedPtr + const std::unique_ptr cb(new wxCheckBox(wxTheApp->GetTopWindow(), wxID_ANY, ORIGINAL_LABEL)); DoTestLabel(cb.get()); } diff --git a/tests/controls/notebooktest.cpp b/tests/controls/notebooktest.cpp index d1533f26fc..8dd84518a7 100644 --- a/tests/controls/notebooktest.cpp +++ b/tests/controls/notebooktest.cpp @@ -17,12 +17,13 @@ #endif // WX_PRECOMP #include "wx/notebook.h" -#include "wx/scopedptr.h" #include "asserthelper.h" #include "bookctrlbasetest.h" #include "testableframe.h" +#include + class NotebookTestCase : public BookCtrlBaseTestCase, public CppUnit::TestCase { public: @@ -128,7 +129,7 @@ TEST_CASE("wxNotebook::AddPageEvents", "[wxNotebook][AddPage][event]") wxNotebook* const notebook = new wxNotebook(wxTheApp->GetTopWindow(), wxID_ANY, wxDefaultPosition, wxSize(400, 200)); - wxScopedPtr cleanup(notebook); + std::unique_ptr cleanup(notebook); CHECK( notebook->GetSelection() == wxNOT_FOUND ); @@ -172,7 +173,7 @@ void NotebookTestCase::GetTabRect() { wxNotebook *notebook = new wxNotebook(wxTheApp->GetTopWindow(), wxID_ANY, wxDefaultPosition, wxSize(400, 200)); - wxScopedPtr cleanup(notebook); + std::unique_ptr cleanup(notebook); notebook->AddPage(new wxPanel(notebook), "Page"); @@ -217,7 +218,7 @@ void NotebookTestCase::GetTabRect() void NotebookTestCase::HitTestFlags() { - wxScopedPtr notebook; + std::unique_ptr notebook; #if defined(__WXMSW__) || defined(__WXUNIVERSAL__) long style = 0; diff --git a/tests/controls/radioboxtest.cpp b/tests/controls/radioboxtest.cpp index 37f41084f5..b783b83b20 100644 --- a/tests/controls/radioboxtest.cpp +++ b/tests/controls/radioboxtest.cpp @@ -16,9 +16,10 @@ #include "wx/radiobox.h" #endif // WX_PRECOMP -#include "wx/scopedptr.h" #include "wx/tooltip.h" +#include + class RadioBoxTestCase { protected: @@ -195,7 +196,7 @@ TEST_CASE_METHOD(RadioBoxTestCase, "RadioBox::SetString", "[radiobox]") TEST_CASE("RadioBox::NoItems", "[radiobox]") { - wxScopedPtr + std::unique_ptr radio(new wxRadioBox(wxTheApp->GetTopWindow(), wxID_ANY, "Empty", wxDefaultPosition, wxDefaultSize, 0, nullptr, diff --git a/tests/controls/radiobuttontest.cpp b/tests/controls/radiobuttontest.cpp index 7ec277dbc4..4f008f620a 100644 --- a/tests/controls/radiobuttontest.cpp +++ b/tests/controls/radiobuttontest.cpp @@ -24,6 +24,8 @@ #include "testableframe.h" #include "testwindow.h" +#include + class RadioButtonTestCase { public: @@ -89,22 +91,22 @@ TEST_CASE_METHOD(RadioButtonTestCase, "RadioButton::Group", "[radiobutton]") wxWindow* const parent = wxTheApp->GetTopWindow(); // Create two different radio groups. - wxScopedPtr g1radio0(new wxRadioButton(parent, wxID_ANY, "radio 1.0", + std::unique_ptr g1radio0(new wxRadioButton(parent, wxID_ANY, "radio 1.0", wxDefaultPosition, wxDefaultSize, wxRB_GROUP)); - wxScopedPtr g1radio1(new wxRadioButton(parent, wxID_ANY, "radio 1.1")); + std::unique_ptr g1radio1(new wxRadioButton(parent, wxID_ANY, "radio 1.1")); - wxScopedPtr g2radio0(new wxRadioButton(parent, wxID_ANY, "radio 2.0", + std::unique_ptr g2radio0(new wxRadioButton(parent, wxID_ANY, "radio 2.0", wxDefaultPosition, wxDefaultSize, wxRB_GROUP)); - wxScopedPtr g2radio1(new wxRadioButton(parent, wxID_ANY, "radio 2.1")); + std::unique_ptr g2radio1(new wxRadioButton(parent, wxID_ANY, "radio 2.1")); // Check that having another control between radio buttons doesn't break // grouping. - wxScopedPtr text(new wxStaticText(parent, wxID_ANY, "Label")); - wxScopedPtr g2radio2(new wxRadioButton(parent, wxID_ANY, "radio 2.2")); + std::unique_ptr text(new wxStaticText(parent, wxID_ANY, "Label")); + std::unique_ptr g2radio2(new wxRadioButton(parent, wxID_ANY, "radio 2.2")); g1radio0->SetValue(true); g2radio0->SetValue(true); @@ -174,24 +176,24 @@ TEST_CASE_METHOD(RadioButtonTestCase, "RadioButton::Group", "[radiobutton]") TEST_CASE_METHOD(RadioButtonTestCase, "RadioButton::Single", "[radiobutton]") { //Create a group of 2 buttons, having second button selected - wxScopedPtr gradio0(new wxRadioButton(wxTheApp->GetTopWindow(), + std::unique_ptr gradio0(new wxRadioButton(wxTheApp->GetTopWindow(), wxID_ANY, "wxRadioButton", wxDefaultPosition, wxDefaultSize, wxRB_GROUP)); - wxScopedPtr gradio1(new wxRadioButton(wxTheApp->GetTopWindow(), + std::unique_ptr gradio1(new wxRadioButton(wxTheApp->GetTopWindow(), wxID_ANY, "wxRadioButton")); gradio1->SetValue(true); //Create a "single" button (by default it will not be selected) - wxScopedPtr sradio(new wxRadioButton(wxTheApp->GetTopWindow(), + std::unique_ptr sradio(new wxRadioButton(wxTheApp->GetTopWindow(), wxID_ANY, "wxRadioButton", wxDefaultPosition, wxDefaultSize, wxRB_SINGLE)); //Create a non-grouped button and select it - wxScopedPtr ngradio(new wxRadioButton(wxTheApp->GetTopWindow(), + std::unique_ptr ngradio(new wxRadioButton(wxTheApp->GetTopWindow(), wxID_ANY, "wxRadioButton")); ngradio->SetValue(true); @@ -214,7 +216,7 @@ TEST_CASE("RadioButton::Focus", "[radiobutton][focus]") // Create a container panel just to be able to destroy all the windows // created here at once by simply destroying it. wxWindow* const tlw = wxTheApp->GetTopWindow(); - wxScopedPtr parentPanel(new wxPanel(tlw)); + std::unique_ptr parentPanel(new wxPanel(tlw)); // Create a panel containing 2 radio buttons and another control outside // this panel, so that we could give focus to something different and then diff --git a/tests/controls/spinctrldbltest.cpp b/tests/controls/spinctrldbltest.cpp index c31e83aa84..0543e4d704 100644 --- a/tests/controls/spinctrldbltest.cpp +++ b/tests/controls/spinctrldbltest.cpp @@ -17,9 +17,10 @@ #include "testableframe.h" #include "wx/uiaction.h" -#include "wx/scopedptr.h" #include "wx/spinctrl.h" +#include + class SpinCtrlDoubleTestCase { public: @@ -55,7 +56,7 @@ TEST_CASE("SpinCtrlDouble::NoEventsInCtor", "[spinctrl][spinctrldouble]") { // Verify that creating the control does not generate any events. This is // unexpected and shouldn't happen. - wxScopedPtr m_spin(new wxSpinCtrlDouble); + std::unique_ptr m_spin(new wxSpinCtrlDouble); EventCounter updatedSpin(m_spin.get(), wxEVT_SPINCTRLDOUBLE); EventCounter updatedText(m_spin.get(), wxEVT_TEXT); @@ -246,7 +247,7 @@ TEST_CASE_METHOD(SpinCtrlDoubleTestCase, static inline unsigned int GetInitialDigits(double inc) { - wxScopedPtr sc(new wxSpinCtrlDouble + std::unique_ptr sc(new wxSpinCtrlDouble ( wxTheApp->GetTopWindow(), wxID_ANY, diff --git a/tests/controls/textctrltest.cpp b/tests/controls/textctrltest.cpp index 59af3313c8..119fdc1979 100644 --- a/tests/controls/textctrltest.cpp +++ b/tests/controls/textctrltest.cpp @@ -21,7 +21,6 @@ #endif // WX_PRECOMP #include "wx/platinfo.h" -#include "wx/scopedptr.h" #include "wx/uiaction.h" #if wxUSE_CLIPBOARD @@ -39,6 +38,8 @@ #include "testableframe.h" #include "asserthelper.h" +#include + static const int TEXT_HEIGHT = 200; #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) @@ -1319,7 +1320,7 @@ TEST_CASE("wxTextCtrl::GetBestSize", "[wxTextCtrl][best-size]") { wxSize operator()(const wxString& text) const { - wxScopedPtr + std::unique_ptr t(new wxTextCtrl(wxTheApp->GetTopWindow(), wxID_ANY, text, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE)); @@ -1388,7 +1389,7 @@ TEST_CASE("wxTextCtrl::LongPaste", "[wxTextCtrl][clipboard][paste]") return; } - wxScopedPtr + std::unique_ptr text(new wxTextCtrl(wxTheApp->GetTopWindow(), wxID_ANY, wxString(), wxDefaultPosition, wxDefaultSize, style)); @@ -1431,7 +1432,7 @@ TEST_CASE("wxTextCtrl::EventsOnCreate", "[wxTextCtrl][event]") EventCounter updated(parent, wxEVT_TEXT); - wxScopedPtr text(new wxTextCtrl(parent, wxID_ANY, "Hello")); + std::unique_ptr text(new wxTextCtrl(parent, wxID_ANY, "Hello")); // Creating the control shouldn't result in any wxEVT_TEXT events. CHECK( updated.GetCount() == 0 ); @@ -1471,7 +1472,7 @@ TEST_CASE("wxTextCtrl::InitialCanUndo", "[wxTextCtrl][undo]") INFO("wxTextCtrl with style " << style); wxWindow* const parent = wxTheApp->GetTopWindow(); - wxScopedPtr text(new wxTextCtrl(parent, wxID_ANY, "", + std::unique_ptr text(new wxTextCtrl(parent, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, style)); @@ -1494,7 +1495,7 @@ TEST_CASE("wxTextCtrl::EmptyUndoBuffer", "[wxTextCtrl][undo]") return; } - wxScopedPtr text(new wxTextCtrl(wxTheApp->GetTopWindow(), + std::unique_ptr text(new wxTextCtrl(wxTheApp->GetTopWindow(), wxID_ANY, "", wxDefaultPosition, wxDefaultSize, diff --git a/tests/controls/textentrytest.cpp b/tests/controls/textentrytest.cpp index 410b6d8aff..ed00e9236c 100644 --- a/tests/controls/textentrytest.cpp +++ b/tests/controls/textentrytest.cpp @@ -22,9 +22,10 @@ #include "textentrytest.h" #include "testableframe.h" -#include "wx/scopedptr.h" #include "wx/uiaction.h" +#include + void TextEntryTestCase::SetValue() { wxTextEntry * const entry = GetTestEntry(); @@ -532,7 +533,7 @@ void TestProcessEnter(const TextLikeControlCreator& controlCreator) SECTION("Without wxTE_PROCESS_ENTER but with wxTE_MULTILINE") { - wxScopedPtr + std::unique_ptr multiLineCreator(controlCreator.CloneAsMultiLine()); if ( !multiLineCreator ) return; @@ -544,7 +545,7 @@ void TestProcessEnter(const TextLikeControlCreator& controlCreator) SECTION("With wxTE_PROCESS_ENTER and wxTE_MULTILINE but skipping") { - wxScopedPtr + std::unique_ptr multiLineCreator(controlCreator.CloneAsMultiLine()); if ( !multiLineCreator ) return; @@ -556,7 +557,7 @@ void TestProcessEnter(const TextLikeControlCreator& controlCreator) SECTION("With wxTE_PROCESS_ENTER and wxTE_MULTILINE without skipping") { - wxScopedPtr + std::unique_ptr multiLineCreator(controlCreator.CloneAsMultiLine()); if ( !multiLineCreator ) return; diff --git a/tests/controls/windowtest.cpp b/tests/controls/windowtest.cpp index 79e1221f42..6041bcb2fa 100644 --- a/tests/controls/windowtest.cpp +++ b/tests/controls/windowtest.cpp @@ -24,11 +24,12 @@ #include "wx/caret.h" #include "wx/cshelp.h" #include "wx/dcclient.h" -#include "wx/scopedptr.h" #include "wx/stopwatch.h" #include "wx/tooltip.h" #include "wx/wupdlock.h" +#include + class WindowTestCase { public: @@ -443,8 +444,8 @@ TEST_CASE_METHOD(WindowTestCase, "Window::FindWindowBy", "[window]") TEST_CASE_METHOD(WindowTestCase, "Window::SizerErrors", "[window][sizer][error]") { wxWindow* const child = new wxWindow(m_window, wxID_ANY); - wxScopedPtr const sizer1(new wxBoxSizer(wxHORIZONTAL)); - wxScopedPtr const sizer2(new wxBoxSizer(wxHORIZONTAL)); + std::unique_ptr const sizer1(new wxBoxSizer(wxHORIZONTAL)); + std::unique_ptr const sizer2(new wxBoxSizer(wxHORIZONTAL)); REQUIRE_NOTHROW( sizer1->Add(child) ); #ifdef __WXDEBUG__ diff --git a/tests/events/propagation.cpp b/tests/events/propagation.cpp index aa7b304f8f..771e0e5bb2 100644 --- a/tests/events/propagation.cpp +++ b/tests/events/propagation.cpp @@ -23,12 +23,13 @@ #include "wx/docmdi.h" #include "wx/frame.h" #include "wx/menu.h" -#include "wx/scopedptr.h" #include "wx/scopeguard.h" #include "wx/toolbar.h" #include "wx/uiaction.h" #include "wx/stopwatch.h" +#include + // FIXME: Currently under OS X testing paint event doesn't work because neither // calling Refresh()+Update() nor even sending wxPaintEvent directly to // the window doesn't result in calls to its event handlers, so disable @@ -464,7 +465,7 @@ void EventPropagationTestCase::MenuEvent() wxMenu* const menu = CreateTestMenu(frame); #if wxUSE_MENUBAR wxMenuBar* const mb = menu->GetMenuBar(); - wxScopedPtr ensureMenuBarDestruction(mb); + std::unique_ptr ensureMenuBarDestruction(mb); wxON_BLOCK_EXIT_OBJ1( *frame, wxFrame::SetMenuBar, (wxMenuBar*)nullptr ); #endif // Check that wxApp gets the event exactly once. @@ -537,7 +538,7 @@ void EventPropagationTestCase::DocView() // Set up the parent frame and its menu bar. wxDocManager docManager; - wxScopedPtr + std::unique_ptr parent(new wxDocMDIParentFrame(&docManager, nullptr, wxID_ANY, "Parent")); wxMenu* const menu = CreateTestMenu(parent.get()); @@ -565,7 +566,7 @@ void EventPropagationTestCase::DocView() wxDocument* const doc = docTemplate.CreateDocument(""); wxView* const view = doc->GetFirstView(); - wxScopedPtr + std::unique_ptr child(new wxDocMDIChildFrame(doc, view, parent.get(), wxID_ANY, "Child")); wxMenu* const menuChild = CreateTestMenu(child.get()); diff --git a/tests/filesys/filesystest.cpp b/tests/filesys/filesystest.cpp index 18fecd7310..85aaae0317 100644 --- a/tests/filesys/filesystest.cpp +++ b/tests/filesys/filesystest.cpp @@ -22,7 +22,8 @@ #if wxUSE_FILESYSTEM #include "wx/fs_mem.h" -#include "wx/scopedptr.h" + +#include // ---------------------------------------------------------------------------- // helpers @@ -196,7 +197,7 @@ TEST_CASE("wxFileSystem::MemoryFSHandler", "[filesys][memoryfshandler][find]") } private: - wxScopedPtr const m_handler; + std::unique_ptr const m_handler; } autoMemoryFSHandler; wxMemoryFSHandler::AddFile("foo.txt", "foo contents"); diff --git a/tests/fswatcher/fswatchertest.cpp b/tests/fswatcher/fswatchertest.cpp index a6ab80bd13..f3d9e1496b 100644 --- a/tests/fswatcher/fswatchertest.cpp +++ b/tests/fswatcher/fswatchertest.cpp @@ -24,12 +24,13 @@ #include "wx/filefn.h" #include "wx/fswatcher.h" #include "wx/log.h" -#include "wx/scopedptr.h" #include "wx/stdpaths.h" #include "wx/vector.h" #include "testfile.h" +#include + // ---------------------------------------------------------------------------- // local functions // ---------------------------------------------------------------------------- @@ -347,7 +348,7 @@ protected: EventGenerator& eg; wxEventLoop m_loop; // loop reference - wxScopedPtr m_watcher; + std::unique_ptr m_watcher; int m_eventTypes; // Which event-types to watch. Normally all of them diff --git a/tests/graphics/clippingbox.cpp b/tests/graphics/clippingbox.cpp index d30bf5df9f..d5da29af1a 100644 --- a/tests/graphics/clippingbox.cpp +++ b/tests/graphics/clippingbox.cpp @@ -20,11 +20,12 @@ #include "wx/app.h" #include "wx/window.h" #include "wx/dcclient.h" -#include "wx/scopedptr.h" #include "testfile.h" #include "waitforpaint.h" +#include + static const wxSize s_dcSize(260, 300); static const wxColour s_bgColour(*wxWHITE); // colour to draw outside clipping box static const wxColour s_fgColour(*wxGREEN); // colour to draw inside clipping box @@ -3978,9 +3979,9 @@ TEST_CASE("ClippingBoxTestCase::wxPaintDC", "[clip][dc][paintdc]") #if defined(__WXGTK__) // Under wxGTK we need to have two children (at least) because if there // is one child its paint area is set to fill the whole parent frame. - wxScopedPtr w0(new wxWindow(wxTheApp->GetTopWindow(), wxID_ANY)); + std::unique_ptr w0(new wxWindow(wxTheApp->GetTopWindow(), wxID_ANY)); #endif // wxGTK - wxScopedPtr win(new wxWindow(wxTheApp->GetTopWindow(), wxID_ANY, wxPoint(0, 0))); + std::unique_ptr win(new wxWindow(wxTheApp->GetTopWindow(), wxID_ANY, wxPoint(0, 0))); win->SetClientSize(s_dcSize); // Wait for the first paint event to be sure @@ -4337,7 +4338,7 @@ TEST_CASE("ClippingBoxTestCase::wxPaintDC", "[clip][dc][paintdc]") // Helper functions -static inline void FlushGC(wxScopedPtr& gc) +static inline void FlushGC(std::unique_ptr& gc) { gc->Flush(); #if defined(__WXMSW__) && wxUSE_GRAPHICS_DIRECT2D @@ -4364,7 +4365,7 @@ static void CheckClipPos(wxGraphicsContext* gc, x, y, width, height, posTolerance); } -static void CheckClipBox(wxScopedPtr& gc, const wxBitmap& bmp, +static void CheckClipBox(std::unique_ptr& gc, const wxBitmap& bmp, int x, int y, int w, int h, int xPh, int yPh, int wPh, int hPh) { @@ -4381,7 +4382,7 @@ static void CheckClipBox(wxScopedPtr& gc, const wxBitmap& bmp } } -static void CheckClipShape(wxScopedPtr& gc, const wxBitmap& bmp, const wxBitmap& bmpRef, int posTolerance) +static void CheckClipShape(std::unique_ptr& gc, const wxBitmap& bmp, const wxBitmap& bmpRef, int posTolerance) { // Update wxGraphicsContext contents. FlushGC(gc); @@ -4407,7 +4408,7 @@ void ClearGC(wxGraphicsContext* gc) // Actual tests -static void InitialState(wxScopedPtr& gc, const wxBitmap& bmp, const wxPoint& parentDcOrigin) +static void InitialState(std::unique_ptr& gc, const wxBitmap& bmp, const wxPoint& parentDcOrigin) { // Initial clipping box should be the same as the entire GC surface. ClearGC(gc.get()); @@ -4415,7 +4416,7 @@ static void InitialState(wxScopedPtr& gc, const wxBitmap& bmp 0, 0, s_dcSize.GetWidth(), s_dcSize.GetHeight()); } -static void InitialStateWithTransformedGC(wxScopedPtr& gc, const wxBitmap& bmp, const wxPoint& parentDcOrigin) +static void InitialStateWithTransformedGC(std::unique_ptr& gc, const wxBitmap& bmp, const wxPoint& parentDcOrigin) { // Initial clipping box with transformed GC. wxGraphicsMatrix m = gc->CreateMatrix(); @@ -4436,7 +4437,7 @@ static void InitialStateWithTransformedGC(wxScopedPtr& gc, co 0, 0, s_dcSize.GetWidth(), s_dcSize.GetHeight()); } -static void OneRegion(wxScopedPtr& gc, const wxBitmap& bmp, const wxPoint& parentDcOrigin) +static void OneRegion(std::unique_ptr& gc, const wxBitmap& bmp, const wxPoint& parentDcOrigin) { // Setting one clipping region inside DC area. const int x = 10; @@ -4450,7 +4451,7 @@ static void OneRegion(wxScopedPtr& gc, const wxBitmap& bmp, c x + parentDcOrigin.x, y + parentDcOrigin.y, w, h); } -static void OneLargeRegion(wxScopedPtr& gc, const wxBitmap& bmp, const wxPoint& parentDcOrigin) +static void OneLargeRegion(std::unique_ptr& gc, const wxBitmap& bmp, const wxPoint& parentDcOrigin) { // Setting one clipping region larger then GC surface. // Final clipping box should be limited to the GC extents. @@ -4461,7 +4462,7 @@ static void OneLargeRegion(wxScopedPtr& gc, const wxBitmap& b 0, 0, s_dcSize.GetWidth(), s_dcSize.GetHeight()); } -static void OneOuterRegion(wxScopedPtr& gc, const wxBitmap& bmp) +static void OneOuterRegion(std::unique_ptr& gc, const wxBitmap& bmp) { // Setting one clipping region entirely outside GC surface. // Final clipping box should be empty. @@ -4471,7 +4472,7 @@ static void OneOuterRegion(wxScopedPtr& gc, const wxBitmap& b 0, 0, 0, 0); } -static void OneRegionNegDim(wxScopedPtr& gc, const wxBitmap& bmp, const wxPoint& parentDcOrigin) +static void OneRegionNegDim(std::unique_ptr& gc, const wxBitmap& bmp, const wxPoint& parentDcOrigin) { // Setting one clipping region with negative sizes values. // Final clipping box should have standard positive size values. @@ -4490,7 +4491,7 @@ static void OneRegionNegDim(wxScopedPtr& gc, const wxBitmap& r.GetLeft() + parentDcOrigin.x, r.GetTop() + parentDcOrigin.y, r.GetWidth(), r.GetHeight()); } -static void OneRegionAndReset(wxScopedPtr& gc, const wxBitmap& bmp, const wxPoint& parentDcOrigin) +static void OneRegionAndReset(std::unique_ptr& gc, const wxBitmap& bmp, const wxPoint& parentDcOrigin) { // Setting one clipping region and next destroy it. // Final clipping box should be the same as GC surface. @@ -4501,7 +4502,7 @@ static void OneRegionAndReset(wxScopedPtr& gc, const wxBitmap 0, 0, s_dcSize.GetWidth(), s_dcSize.GetHeight()); } -static void OneRegionAndEmpty(wxScopedPtr& gc, const wxBitmap& bmp) +static void OneRegionAndEmpty(std::unique_ptr& gc, const wxBitmap& bmp) { // Setting one clipping region and next an empty box. // Final clipping box should empty. @@ -4512,7 +4513,7 @@ static void OneRegionAndEmpty(wxScopedPtr& gc, const wxBitmap 0, 0, 0, 0); } -static void OneRegionWithTransformedGC(wxScopedPtr& gc, const wxBitmap& bmp, const wxPoint& parentDcOrigin) +static void OneRegionWithTransformedGC(std::unique_ptr& gc, const wxBitmap& bmp, const wxPoint& parentDcOrigin) { // Setting one clipping region inside GC area // with applied some transformations. @@ -4546,7 +4547,7 @@ static void OneRegionWithTransformedGC(wxScopedPtr& gc, const wxRound(xd + parentDcOrigin.x), wxRound(yd + parentDcOrigin.y), wxRound(wd), wxRound(hd)); } -static void OneRegionWithRotatedGC(wxScopedPtr& gc, const wxBitmap& bmp, const wxPoint& parentDcOrigin) +static void OneRegionWithRotatedGC(std::unique_ptr& gc, const wxBitmap& bmp, const wxPoint& parentDcOrigin) { // Setting one rectangular clipping region for rotated graphics context. const double rotAngle = wxDegToRad(1.0); @@ -4570,7 +4571,7 @@ static void OneRegionWithRotatedGC(wxScopedPtr& gc, const wxB memDC.Clear(); memDC.SetDeviceOrigin(parentDcOrigin.x, parentDcOrigin.y); wxGraphicsRenderer* rend = gc->GetRenderer(); - wxScopedPtr gcRef(rend->CreateContext(memDC)); + std::unique_ptr gcRef(rend->CreateContext(memDC)); gcRef->SetAntialiasMode(wxANTIALIAS_NONE); gcRef->DisableOffset(); gcRef->SetBrush(wxBrush(s_bgColour, wxBRUSHSTYLE_SOLID)); @@ -4591,7 +4592,7 @@ static void OneRegionWithRotatedGC(wxScopedPtr& gc, const wxB CheckClipShape(gc, bmp, bmpRef, 1); } -static void TwoRegionsOverlapping(wxScopedPtr& gc, const wxBitmap& bmp, const wxPoint& parentDcOrigin) +static void TwoRegionsOverlapping(std::unique_ptr& gc, const wxBitmap& bmp, const wxPoint& parentDcOrigin) { // Setting one clipping region and next another region (partially overlapping). // Final clipping box should be an intersection of these two boxes. @@ -4607,7 +4608,7 @@ static void TwoRegionsOverlapping(wxScopedPtr& gc, const wxBi r.GetLeft() + parentDcOrigin.x, r.GetTop() + parentDcOrigin.y, r.GetWidth(), r.GetHeight()); } -static void TwoRegionsOverlappingNegDim(wxScopedPtr& gc, const wxBitmap& bmp, const wxPoint& parentDcOrigin) +static void TwoRegionsOverlappingNegDim(std::unique_ptr& gc, const wxBitmap& bmp, const wxPoint& parentDcOrigin) { // Setting one clipping region with negative size values // and next another region (partially overlapping). @@ -4633,7 +4634,7 @@ static void TwoRegionsOverlappingNegDim(wxScopedPtr& gc, cons r.GetLeft() + parentDcOrigin.x, r.GetTop() + parentDcOrigin.y, r.GetWidth(), r.GetHeight()); } -static void TwoRegionsNonOverlapping(wxScopedPtr& gc, const wxBitmap& bmp) +static void TwoRegionsNonOverlapping(std::unique_ptr& gc, const wxBitmap& bmp) { // Setting one clipping region and next another region (non-overlapping). // Final clipping box should be empty. @@ -4648,7 +4649,7 @@ static void TwoRegionsNonOverlapping(wxScopedPtr& gc, const w 0, 0, 0, 0); } -static void TwoRegionsNonOverlappingNegDim(wxScopedPtr& gc, const wxBitmap& bmp) +static void TwoRegionsNonOverlappingNegDim(std::unique_ptr& gc, const wxBitmap& bmp) { // Setting one clipping region with negative size values // and next another region (non-overlapping). @@ -4673,7 +4674,7 @@ static void TwoRegionsNonOverlappingNegDim(wxScopedPtr& gc, c 0, 0, 0, 0); } -static void RegionsAndPushPopState(wxScopedPtr& gc, const wxBitmap& bmp, const wxDC& parentDc) +static void RegionsAndPushPopState(std::unique_ptr& gc, const wxBitmap& bmp, const wxDC& parentDc) { // Setting muliple rectangular clipping regions // for transformed wxGC and store/restore them. @@ -4745,7 +4746,7 @@ static void RegionsAndPushPopState(wxScopedPtr& gc, const wxB memDC.SetLogicalOrigin(org.x, org.y); wxGraphicsRenderer* rend = gc->GetRenderer(); - wxScopedPtr gcRef(rend->CreateContext(memDC)); + std::unique_ptr gcRef(rend->CreateContext(memDC)); gcRef->SetAntialiasMode(wxANTIALIAS_NONE); gcRef->DisableOffset(); @@ -4798,7 +4799,7 @@ TEST_CASE("ClippingBoxTestCaseGC::DefaultRenderer", "[clip][gc][default]") wxPoint dcOrigin = -dc.DeviceToLogical(0, 0); wxGraphicsRenderer* rend = wxGraphicsRenderer::GetDefaultRenderer(); REQUIRE(rend); - wxScopedPtr gc(rend->CreateContext(dc)); + std::unique_ptr gc(rend->CreateContext(dc)); REQUIRE(gc.get()); gc->SetAntialiasMode(wxANTIALIAS_NONE); gc->DisableOffset(); @@ -4903,7 +4904,7 @@ TEST_CASE("ClippingBoxTestCaseGC::GDI+Renderer", "[clip][gc][gdiplus]") wxPoint dcOrigin = -dc.DeviceToLogical(0, 0); wxGraphicsRenderer* rend = wxGraphicsRenderer::GetGDIPlusRenderer(); REQUIRE(rend); - wxScopedPtr gc(rend->CreateContext(dc)); + std::unique_ptr gc(rend->CreateContext(dc)); REQUIRE(gc.get()); gc->SetAntialiasMode(wxANTIALIAS_NONE); gc->DisableOffset(); @@ -5008,7 +5009,7 @@ TEST_CASE("ClippingBoxTestCaseGC::Direct2DRenderer", "[clip][gc][direct2d]") wxPoint dcOrigin = -dc.DeviceToLogical(0, 0); wxGraphicsRenderer* rend = wxGraphicsRenderer::GetDirect2DRenderer(); REQUIRE(rend); - wxScopedPtr gc(rend->CreateContext(dc)); + std::unique_ptr gc(rend->CreateContext(dc)); REQUIRE(gc.get()); gc->SetAntialiasMode(wxANTIALIAS_NONE); gc->DisableOffset(); @@ -5118,7 +5119,7 @@ TEST_CASE("ClippingBoxTestCaseGC::CairoRenderer", "[clip][gc][cairo]") wxPoint dcOrigin = -dc.DeviceToLogical(0, 0); wxGraphicsRenderer* rend = wxGraphicsRenderer::GetCairoRenderer(); REQUIRE(rend); - wxScopedPtr gc(rend->CreateContext(dc)); + std::unique_ptr gc(rend->CreateContext(dc)); REQUIRE(gc.get()); gc->SetAntialiasMode(wxANTIALIAS_NONE); gc->DisableOffset(); diff --git a/tests/graphics/graphmatrix.cpp b/tests/graphics/graphmatrix.cpp index da6cac66e2..4bb5e10bf6 100644 --- a/tests/graphics/graphmatrix.cpp +++ b/tests/graphics/graphmatrix.cpp @@ -14,6 +14,8 @@ #include "wx/graphics.h" #include "wx/dcmemory.h" +#include + static void InitState(wxGraphicsContext* gc); static void InvertMatrix(wxGraphicsContext* gc); static void Concat1(wxGraphicsContext* gc); @@ -26,7 +28,7 @@ TEST_CASE("GraphicsMatrixTestCase::DefaultRenderer", "[graphmatrix][default]") wxMemoryDC dc(bmp); wxGraphicsRenderer* rend = wxGraphicsRenderer::GetDefaultRenderer(); REQUIRE(rend); - wxScopedPtr gc(rend->CreateContext(dc)); + std::unique_ptr gc(rend->CreateContext(dc)); REQUIRE(gc.get()); SECTION("InitState") @@ -64,7 +66,7 @@ TEST_CASE("GraphicsMatrixTestCase::GDIPlusRenderer", "[graphmatrix][gdiplus]") wxMemoryDC dc(bmp); wxGraphicsRenderer* rend = wxGraphicsRenderer::GetGDIPlusRenderer(); REQUIRE(rend); - wxScopedPtr gc(rend->CreateContext(dc)); + std::unique_ptr gc(rend->CreateContext(dc)); REQUIRE(gc.get()); SECTION("InitState") @@ -101,7 +103,7 @@ TEST_CASE("GraphicsMatrixTestCase::Direct2DRenderer", "[graphmatrix][direct2d]") wxMemoryDC dc(bmp); wxGraphicsRenderer* rend = wxGraphicsRenderer::GetDirect2DRenderer(); REQUIRE(rend); - wxScopedPtr gc(rend->CreateContext(dc)); + std::unique_ptr gc(rend->CreateContext(dc)); REQUIRE(gc.get()); SECTION("InitState") @@ -140,7 +142,7 @@ TEST_CASE("GraphicsMatrixTestCase::CairoRenderer", "[graphmatrix][cairo]") wxMemoryDC dc(bmp); wxGraphicsRenderer* rend = wxGraphicsRenderer::GetCairoRenderer(); REQUIRE(rend); - wxScopedPtr gc(rend->CreateContext(dc)); + std::unique_ptr gc(rend->CreateContext(dc)); REQUIRE(gc.get()); SECTION("InitState") diff --git a/tests/graphics/graphpath.cpp b/tests/graphics/graphpath.cpp index 723ffd65fb..08d159a276 100644 --- a/tests/graphics/graphpath.cpp +++ b/tests/graphics/graphpath.cpp @@ -18,7 +18,8 @@ #include "wx/bitmap.h" #include "wx/dcmemory.h" #include "wx/dcgraph.h" -#include "wx/scopedptr.h" + +#include static void DoAllTests(wxGraphicsContext* gc); @@ -30,7 +31,7 @@ TEST_CASE("GraphicsPathTestCase", "[path]") { wxBitmap bmp(500, 500); wxMemoryDC mdc(bmp); - wxScopedPtr gc(wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(mdc)); + std::unique_ptr gc(wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(mdc)); REQUIRE(gc); DoAllTests(gc.get()); } @@ -42,7 +43,7 @@ TEST_CASE("GraphicsPathTestCaseGDIPlus", "[path][gdi+]") { wxBitmap bmp(500, 500); wxMemoryDC mdc(bmp); - wxScopedPtr gc(wxGraphicsRenderer::GetGDIPlusRenderer()->CreateContext(mdc)); + std::unique_ptr gc(wxGraphicsRenderer::GetGDIPlusRenderer()->CreateContext(mdc)); REQUIRE(gc); DoAllTests(gc.get()); } @@ -56,7 +57,7 @@ TEST_CASE("GraphicsPathTestCaseDirect2D", "[path][d2d]") wxBitmap bmp(500, 500); wxMemoryDC mdc(bmp); - wxScopedPtr gc(wxGraphicsRenderer::GetDirect2DRenderer()->CreateContext(mdc)); + std::unique_ptr gc(wxGraphicsRenderer::GetDirect2DRenderer()->CreateContext(mdc)); REQUIRE(gc); DoAllTests(gc.get()); } @@ -69,7 +70,7 @@ TEST_CASE("GraphicsPathTestCaseCairo", "[path][cairo]") { wxBitmap bmp(500, 500); wxMemoryDC mdc(bmp); - wxScopedPtr gc(wxGraphicsRenderer::GetCairoRenderer()->CreateContext(mdc)); + std::unique_ptr gc(wxGraphicsRenderer::GetCairoRenderer()->CreateContext(mdc)); REQUIRE(gc); DoAllTests(gc.get()); } diff --git a/tests/html/htmlparser.cpp b/tests/html/htmlparser.cpp index f79c0e39a7..56687c6b59 100644 --- a/tests/html/htmlparser.cpp +++ b/tests/html/htmlparser.cpp @@ -20,7 +20,8 @@ #endif // WX_PRECOMP #include "wx/html/winpars.h" -#include "wx/scopedptr.h" + +#include // Test that parsing invalid HTML simply fails but doesn't crash for example. TEST_CASE("wxHtmlParser::ParseInvalid", "[html][parser][error]") @@ -45,7 +46,7 @@ TEST_CASE("wxHtmlCell::Detach", "[html][cell]") { wxMemoryDC dc; - wxScopedPtr const top(new wxHtmlContainerCell(nullptr)); + std::unique_ptr const top(new wxHtmlContainerCell(nullptr)); wxHtmlContainerCell* const cont = new wxHtmlContainerCell(nullptr); wxHtmlCell* const cell1 = new wxHtmlWordCell("Hello", dc); wxHtmlCell* const cell2 = new wxHtmlColourCell(*wxRED); diff --git a/tests/image/image.cpp b/tests/image/image.cpp index 735e2a9eda..35c24d4535 100644 --- a/tests/image/image.cpp +++ b/tests/image/image.cpp @@ -31,10 +31,10 @@ #include "wx/wfstream.h" #include "wx/clipbrd.h" #include "wx/dataobj.h" -#include "wx/scopedptr.h" #include "testimage.h" +#include #define CHECK_EQUAL_COLOUR_RGB(c1, c2) \ CHECK( (int)c1.Red() == (int)c2.Red() ); \ @@ -180,7 +180,7 @@ void ImageTestCase::LoadFromSocketStream() wxURL url(urlStr); REQUIRE( url.GetError() == wxURL_NOERR ); - wxScopedPtr in_stream(url.GetInputStream()); + std::unique_ptr in_stream(url.GetInputStream()); REQUIRE( in_stream ); REQUIRE( in_stream->IsOk() ); diff --git a/tests/lists/lists.cpp b/tests/lists/lists.cpp index 32727dfa2e..7f2ff588ec 100644 --- a/tests/lists/lists.cpp +++ b/tests/lists/lists.cpp @@ -18,7 +18,8 @@ #endif // WX_PRECOMP #include "wx/list.h" -#include "wx/scopedptr.h" + +#include // -------------------------------------------------------------------------- // test class @@ -243,7 +244,7 @@ void ElementsListNode::DeleteData() TEST_CASE("wxWindowList::Find", "[list]") { ListElement* const el = new ListElement(17); - wxScopedPtr elb(el); + std::unique_ptr elb(el); ElementsList l; l.Append(el); diff --git a/tests/menu/accelentry.cpp b/tests/menu/accelentry.cpp index 85774661be..e614c523df 100644 --- a/tests/menu/accelentry.cpp +++ b/tests/menu/accelentry.cpp @@ -17,7 +17,8 @@ #endif // WX_PRECOMP #include "wx/accel.h" -#include "wx/scopedptr.h" + +#include namespace { @@ -36,7 +37,7 @@ void CheckAccelEntry(const wxAcceleratorEntry& accel, int keycode, int flags) */ TEST_CASE( "wxAcceleratorEntry::Create", "[accelentry]" ) { - wxScopedPtr pa; + std::unique_ptr pa; SECTION( "Correct behavior" ) { diff --git a/tests/menu/menu.cpp b/tests/menu/menu.cpp index 78af3ceb25..0be3c38474 100644 --- a/tests/menu/menu.cpp +++ b/tests/menu/menu.cpp @@ -20,12 +20,13 @@ #endif // WX_PRECOMP #include "wx/menu.h" -#include "wx/scopedptr.h" #include "wx/translation.h" #include "wx/uiaction.h" #include +#include + // ---------------------------------------------------------------------------- // helper // ---------------------------------------------------------------------------- @@ -668,7 +669,7 @@ namespace void VerifyAccelAssigned( wxString labelText, int keycode ) { - const wxScopedPtr entry( + const std::unique_ptr entry( wxAcceleratorEntry::Create( labelText ) ); diff --git a/tests/misc/guifuncs.cpp b/tests/misc/guifuncs.cpp index 414d2f8362..ed6016f5c9 100644 --- a/tests/misc/guifuncs.cpp +++ b/tests/misc/guifuncs.cpp @@ -25,10 +25,11 @@ #include "wx/clipbrd.h" #include "wx/dataobj.h" #include "wx/panel.h" -#include "wx/scopedptr.h" #include "asserthelper.h" +#include + // ---------------------------------------------------------------------------- // the tests // ---------------------------------------------------------------------------- @@ -142,9 +143,9 @@ TEST_CASE("GUI::ClientToScreen", "[guifuncs]") wxWindow* const tlw = wxTheApp->GetTopWindow(); REQUIRE( tlw ); - wxScopedPtr const + std::unique_ptr const p1(new wxPanel(tlw, wxID_ANY, wxPoint(0, 0), wxSize(100, 50))); - wxScopedPtr const + std::unique_ptr const p2(new wxPanel(tlw, wxID_ANY, wxPoint(0, 50), wxSize(100, 50))); wxWindow* const b = new wxWindow(p2.get(), wxID_ANY, wxPoint(10, 10), wxSize(30, 10)); @@ -194,10 +195,10 @@ TEST_CASE("GUI::FindWindowAtPoint", "[guifuncs]") // assertion messages. parent->SetLabel("parent"); - wxScopedPtr btn1(new TestButton(parent, "1", wxPoint(10, 10))); - wxScopedPtr btn2(new TestButton(parent, "2", wxPoint(10, 90))); + std::unique_ptr btn1(new TestButton(parent, "1", wxPoint(10, 10))); + std::unique_ptr btn2(new TestButton(parent, "2", wxPoint(10, 90))); - // No need to use wxScopedPtr<> for this one, it will be deleted by btn2. + // No need to use std::unique_ptr<> for this one, it will be deleted by btn2. wxWindow* btn3 = new TestButton(btn2.get(), "3", wxPoint(20, 20)); // We need this to realize the windows created above under wxGTK. @@ -233,7 +234,7 @@ TEST_CASE("wxWindow::Dump", "[window]") { CHECK_NOTHROW( wxDumpWindow(nullptr) ); - wxScopedPtr + std::unique_ptr button(new wxButton(wxTheApp->GetTopWindow(), wxID_ANY, "bloordyblop")); const std::string s = wxDumpWindow(button.get()).utf8_string(); diff --git a/tests/net/socket.cpp b/tests/net/socket.cpp index feccfd4883..8d730658a2 100644 --- a/tests/net/socket.cpp +++ b/tests/net/socket.cpp @@ -23,12 +23,13 @@ #include "wx/socket.h" #include "wx/url.h" -#include "wx/scopedptr.h" #include "wx/sstream.h" #include "wx/evtloop.h" -typedef wxScopedPtr wxSockAddressPtr; -typedef wxScopedPtr wxSocketClientPtr; +#include + +typedef std::unique_ptr wxSockAddressPtr; +typedef std::unique_ptr wxSocketClientPtr; static wxString gs_serverHost(wxGetenv("WX_TEST_SERVER")); @@ -294,7 +295,7 @@ void SocketTestCase::UrlTest() wxURL url("http://" + gs_serverHost); - const wxScopedPtr in(url.GetInputStream()); + const std::unique_ptr in(url.GetInputStream()); CPPUNIT_ASSERT( in.get() ); wxStringOutputStream out; diff --git a/tests/net/webrequest.cpp b/tests/net/webrequest.cpp index ab85f39ec2..071c217f6e 100644 --- a/tests/net/webrequest.cpp +++ b/tests/net/webrequest.cpp @@ -23,6 +23,8 @@ #include "wx/filename.h" #include "wx/wfstream.h" +#include + // This test uses httpbin service and by default uses the mirror at the // location below, which seems to be more reliable than the main site at // https://httpbin.org. Any other mirror, including a local one, which can be @@ -394,7 +396,7 @@ TEST_CASE_METHOD(RequestFixture, return; Create("/put"); - wxScopedPtr is(new wxFileInputStream("horse.png")); + std::unique_ptr is(new wxFileInputStream("horse.png")); REQUIRE( is->IsOk() ); request.SetData(is.release(), "image/png"); diff --git a/tests/sizers/boxsizer.cpp b/tests/sizers/boxsizer.cpp index c6dea9cf38..76a68910f0 100644 --- a/tests/sizers/boxsizer.cpp +++ b/tests/sizers/boxsizer.cpp @@ -21,7 +21,7 @@ #include "asserthelper.h" -#include "wx/scopedptr.h" +#include // ---------------------------------------------------------------------------- // test fixture @@ -366,7 +366,7 @@ TEST_CASE_METHOD(BoxSizerTestCase, "BoxSizer::IncompatibleFlags", "[sizer]") #define ASSERT_SIZER_INVALID_FLAGS(f, msg) \ WX_ASSERT_FAILS_WITH_ASSERT_MESSAGE( \ "Expected assertion not generated for " msg, \ - wxScopedPtr item(new wxSizerItem(10, 10, 0, f)); \ + std::unique_ptr item(new wxSizerItem(10, 10, 0, f)); \ sizer->Add(item.get()); \ item.release() \ ) diff --git a/tests/sizers/wrapsizer.cpp b/tests/sizers/wrapsizer.cpp index a6d3376140..bfe7298a8f 100644 --- a/tests/sizers/wrapsizer.cpp +++ b/tests/sizers/wrapsizer.cpp @@ -21,9 +21,11 @@ #include "asserthelper.h" +#include + TEST_CASE("wxWrapSizer::CalcMin", "[wxWrapSizer]") { - wxScopedPtr win(new wxWindow(wxTheApp->GetTopWindow(), wxID_ANY)); + std::unique_ptr win(new wxWindow(wxTheApp->GetTopWindow(), wxID_ANY)); win->SetClientSize(180, 240); wxSizer *sizer = new wxWrapSizer(wxHORIZONTAL); @@ -74,7 +76,7 @@ TEST_CASE("wxWrapSizer::CalcMin", "[wxWrapSizer]") TEST_CASE("wxWrapSizer::CalcMinFromMinor", "[wxWrapSizer]") { - wxScopedPtr win(new wxWindow(wxTheApp->GetTopWindow(), wxID_ANY)); + std::unique_ptr win(new wxWindow(wxTheApp->GetTopWindow(), wxID_ANY)); win->SetClientSize(180, 240); wxSizer* boxSizer = new wxBoxSizer(wxHORIZONTAL); diff --git a/tests/streams/largefile.cpp b/tests/streams/largefile.cpp index 16552b139e..74fe73d594 100644 --- a/tests/streams/largefile.cpp +++ b/tests/streams/largefile.cpp @@ -29,9 +29,10 @@ #endif #include "wx/filename.h" -#include "wx/scopedptr.h" #include "wx/wfstream.h" +#include + #ifdef __WINDOWS__ #include "wx/msw/wrapwin.h" #ifdef __VISUALC__ @@ -116,7 +117,7 @@ void LargeFileTest::runTest() // write a large file { - wxScopedPtr out(MakeOutStream(tmpfile.m_name)); + std::unique_ptr out(MakeOutStream(tmpfile.m_name)); // write 'A's at [ 0x7fffffbf, 0x7fffffff [ pos = 0x7fffffff - size; @@ -150,7 +151,7 @@ void LargeFileTest::runTest() // read the large file back { - wxScopedPtr in(MakeInStream(tmpfile.m_name)); + std::unique_ptr in(MakeInStream(tmpfile.m_name)); char buf[size]; if (haveLFS) { @@ -214,7 +215,7 @@ protected: wxInputStream *LargeFileTest_wxFile::MakeInStream(const wxString& name) const { - wxScopedPtr in(new wxFileInputStream(name)); + std::unique_ptr in(new wxFileInputStream(name)); CPPUNIT_ASSERT(in->IsOk()); return in.release(); } @@ -246,7 +247,7 @@ protected: wxInputStream *LargeFileTest_wxFFile::MakeInStream(const wxString& name) const { - wxScopedPtr in(new wxFFileInputStream(name)); + std::unique_ptr in(new wxFFileInputStream(name)); CPPUNIT_ASSERT(in->IsOk()); return in.release(); } diff --git a/tests/testwindow.h b/tests/testwindow.h index 00f8003ec5..0a4d546acd 100644 --- a/tests/testwindow.h +++ b/tests/testwindow.h @@ -9,9 +9,10 @@ #ifndef _WX_TESTS_TESTWINDOW_H_ #define _WX_TESTS_TESTWINDOW_H_ -#include "wx/scopedptr.h" #include "wx/window.h" +#include + // We need to wrap wxWindow* in a class as specializing StringMaker for // wxWindow* doesn't seem to work. class wxWindowPtr @@ -19,7 +20,7 @@ class wxWindowPtr public: explicit wxWindowPtr(wxWindow* win) : m_win(win) {} template - explicit wxWindowPtr(const wxScopedPtr& win) : m_win(win.get()) {} + explicit wxWindowPtr(const std::unique_ptr& win) : m_win(win.get()) {} wxString Dump() const { diff --git a/tests/uris/url.cpp b/tests/uris/url.cpp index 31c92544bd..616dd014a4 100644 --- a/tests/uris/url.cpp +++ b/tests/uris/url.cpp @@ -19,9 +19,10 @@ #include "wx/url.h" #include "wx/mstream.h" -#include "wx/scopedptr.h" #include "wx/utils.h" +#include + // ---------------------------------------------------------------------------- // test class // ---------------------------------------------------------------------------- @@ -76,7 +77,7 @@ void URLTestCase::GetInputStream() wxURL url("http://detectportal.firefox.com/"); CPPUNIT_ASSERT_EQUAL(wxURL_NOERR, url.GetError()); - wxScopedPtr in_stream(url.GetInputStream()); + std::unique_ptr in_stream(url.GetInputStream()); if ( !in_stream && IsAutomaticTest() ) { // Sometimes the connection fails during CI runs, don't consider this diff --git a/tests/window/clientsize.cpp b/tests/window/clientsize.cpp index f95cc2e2aa..61f2b87cec 100644 --- a/tests/window/clientsize.cpp +++ b/tests/window/clientsize.cpp @@ -18,7 +18,7 @@ #include "wx/window.h" #endif // WX_PRECOMP -#include "wx/scopedptr.h" +#include #include "asserthelper.h" #include "waitforpaint.h" @@ -44,7 +44,7 @@ TEST_CASE("wxWindow::ClientWindowSizeRoundTrip", "[window][client-size]") TEST_CASE("wxWindow::MinClientSize", "[window][client-size]") { - wxScopedPtr w(new wxWindow(wxTheApp->GetTopWindow(), wxID_ANY, + std::unique_ptr w(new wxWindow(wxTheApp->GetTopWindow(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_THEME)); w->SetSize(wxSize(1,1)); @@ -59,9 +59,9 @@ TEST_CASE("wxWindow::SetClientSize", "[window][client-size]") // Under wxGTK2 we need to have two children (at least) because if there // is exactly one child its size is set to fill the whole parent frame // and the window cannot be resized - see wxTopLevelWindowBase::Layout(). - wxScopedPtr w0(new wxWindow(wxTheApp->GetTopWindow(), wxID_ANY)); + std::unique_ptr w0(new wxWindow(wxTheApp->GetTopWindow(), wxID_ANY)); #endif // wxGTK 2 - wxScopedPtr w(new wxWindow(wxTheApp->GetTopWindow(), wxID_ANY)); + std::unique_ptr w(new wxWindow(wxTheApp->GetTopWindow(), wxID_ANY)); wxRect reqSize = wxTheApp->GetTopWindow()->GetClientRect(); reqSize.Deflate(25); diff --git a/tests/window/setsize.cpp b/tests/window/setsize.cpp index aeb995dbae..d30fb22fdb 100644 --- a/tests/window/setsize.cpp +++ b/tests/window/setsize.cpp @@ -19,7 +19,7 @@ #include "wx/window.h" #endif // WX_PRECOMP -#include "wx/scopedptr.h" +#include #include "asserthelper.h" #include "waitforpaint.h" @@ -52,7 +52,7 @@ protected: TEST_CASE("wxWindow::SetSize", "[window][size]") { - wxScopedPtr w(new MyWindow(wxTheApp->GetTopWindow())); + std::unique_ptr w(new MyWindow(wxTheApp->GetTopWindow())); SECTION("Simple") { @@ -73,7 +73,7 @@ TEST_CASE("wxWindow::SetSize", "[window][size]") TEST_CASE("wxWindow::GetBestSize", "[window][size][best-size]") { - wxScopedPtr w(new MyWindow(wxTheApp->GetTopWindow())); + std::unique_ptr w(new MyWindow(wxTheApp->GetTopWindow())); CHECK( wxSize(50, 250) == w->GetBestSize() ); @@ -86,7 +86,7 @@ TEST_CASE("wxWindow::GetBestSize", "[window][size][best-size]") TEST_CASE("wxWindow::MovePreservesSize", "[window][size][move]") { - wxScopedPtr + std::unique_ptr w(new wxFrame(wxTheApp->GetTopWindow(), wxID_ANY, "Test child frame")); // Unfortunately showing the window is asynchronous, at least when using diff --git a/tests/xml/xmltest.cpp b/tests/xml/xmltest.cpp index 8b83e5685a..f09d887d75 100644 --- a/tests/xml/xmltest.cpp +++ b/tests/xml/xmltest.cpp @@ -18,11 +18,12 @@ #endif // WX_PRECOMP #include "wx/xml/xml.h" -#include "wx/scopedptr.h" #include "wx/sstream.h" #include +#include + // ---------------------------------------------------------------------------- // helpers for testing XML tree // ---------------------------------------------------------------------------- @@ -107,7 +108,7 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( XmlTestCase, "XmlTestCase" ); void XmlTestCase::InsertChild() { - wxScopedPtr root(new wxXmlNode(wxXML_ELEMENT_NODE, "root")); + std::unique_ptr 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 root(new wxXmlNode(wxXML_ELEMENT_NODE, "root")); + std::unique_ptr root(new wxXmlNode(wxXML_ELEMENT_NODE, "root")); root->InsertChildAfter(new wxXmlNode(wxXML_ELEMENT_NODE, "1"), nullptr); CheckXml(root.get(), "1", nullptr); diff --git a/tests/xml/xrctest.cpp b/tests/xml/xrctest.cpp index 67bffc5890..53445e8609 100644 --- a/tests/xml/xrctest.cpp +++ b/tests/xml/xrctest.cpp @@ -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 +#include + #include "testfile.h" // ---------------------------------------------------------------------------- @@ -44,7 +45,7 @@ static const char *TEST_XRC_FILE = "test.xrc"; void LoadXrcFrom(const wxString& xrcText) { wxStringInputStream sis(xrcText); - wxScopedPtr xmlDoc(new wxXmlDocument(sis, "UTF-8")); + std::unique_ptr xmlDoc(new wxXmlDocument(sis, "UTF-8")); REQUIRE( xmlDoc->IsOk() ); // Load the xrc we've just created