From 58a37d1c5ae5280612d0935ec038687cb904d87d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 14 Oct 2013 15:08:02 +0000 Subject: [PATCH] Don't leave dangling comboboxes in the GUI unit test suite. Sort() and ReadOnly() tests created a new combobox without deleting the old one, and so these comboboxes were left on the screen for the duration of all the subsequent tests, subtly breaking them. E.g. this was responsible for spurious breakages in the event propagation test case because sometimes the context menu event showed the combobox context menu (why this didn't happen always is another question...). It would be great to find some way to ensure that nothing is left after a test terminates but I'm not sure about how to do this with cppunit. So for now just manually delete the extraneous comboboxes. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74998 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- tests/controls/comboboxtest.cpp | 2 ++ tests/controls/ownerdrawncomboboxtest.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tests/controls/comboboxtest.cpp b/tests/controls/comboboxtest.cpp index 3c52fb9a17..96e349b4ed 100644 --- a/tests/controls/comboboxtest.cpp +++ b/tests/controls/comboboxtest.cpp @@ -155,6 +155,7 @@ void ComboBoxTestCase::PopDismiss() void ComboBoxTestCase::Sort() { #if !defined(__WXOSX__) + delete m_combo; m_combo = new wxComboBox(wxTheApp->GetTopWindow(), wxID_ANY, "", wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_SORT); @@ -185,6 +186,7 @@ void ComboBoxTestCase::ReadOnly() testitems.Add("item 1"); testitems.Add("item 2"); + delete m_combo; m_combo = new wxComboBox(wxTheApp->GetTopWindow(), wxID_ANY, "", wxDefaultPosition, wxDefaultSize, testitems, wxCB_READONLY); diff --git a/tests/controls/ownerdrawncomboboxtest.cpp b/tests/controls/ownerdrawncomboboxtest.cpp index 89e02664a3..ca18d25da3 100644 --- a/tests/controls/ownerdrawncomboboxtest.cpp +++ b/tests/controls/ownerdrawncomboboxtest.cpp @@ -140,6 +140,7 @@ void OwnerDrawnComboBoxTestCase::PopDismiss() void OwnerDrawnComboBoxTestCase::Sort() { + delete m_combo; m_combo = new wxOwnerDrawnComboBox(wxTheApp->GetTopWindow(), wxID_ANY, "", wxDefaultPosition, wxDefaultSize, @@ -171,6 +172,7 @@ void OwnerDrawnComboBoxTestCase::ReadOnly() testitems.Add("item 1"); testitems.Add("item 2"); + delete m_combo; m_combo = new wxOwnerDrawnComboBox(wxTheApp->GetTopWindow(), wxID_ANY, "", wxDefaultPosition, wxDefaultSize, testitems,