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
This commit is contained in:
Vadim Zeitlin 2013-10-14 15:08:02 +00:00
parent 13a119cca8
commit 58a37d1c5a
2 changed files with 4 additions and 0 deletions

View File

@ -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);

View File

@ -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,