Implement GetStringSelection() in generic wxBitmapComboBox
Also update the test to avoid assuming that wxBitmapComboBox inherits from wxComboBox, which now allows it to build (and pass) on all platforms. Closes https://github.com/wxWidgets/wxWidgets/pull/2057
This commit is contained in:
committed by
Vadim Zeitlin
parent
1f0ade29f0
commit
61ef150044
@@ -84,6 +84,8 @@ public:
|
||||
|
||||
virtual ~wxBitmapComboBox();
|
||||
|
||||
virtual wxString GetStringSelection() const wxOVERRIDE;
|
||||
|
||||
// Adds item with image to the end of the combo box.
|
||||
int Append(const wxString& item, const wxBitmap& bitmap = wxNullBitmap);
|
||||
int Append(const wxString& item, const wxBitmap& bitmap, void *clientData);
|
||||
|
@@ -135,6 +135,11 @@ wxBitmapComboBox::~wxBitmapComboBox()
|
||||
DoClear();
|
||||
}
|
||||
|
||||
wxString wxBitmapComboBox::GetStringSelection() const
|
||||
{
|
||||
return wxItemContainer::GetStringSelection();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Item manipulation
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -24,9 +24,6 @@
|
||||
#include "itemcontainertest.h"
|
||||
#include "asserthelper.h"
|
||||
|
||||
//Test only if we are based off of wxComboBox
|
||||
#ifndef wxGENERIC_BITMAPCOMBOBOX
|
||||
|
||||
class BitmapComboBoxTestCase : public TextEntryTestCase,
|
||||
public ItemContainerTestCase,
|
||||
public CppUnit::TestCase
|
||||
@@ -82,9 +79,9 @@ void BitmapComboBoxTestCase::Bitmap()
|
||||
wxArrayString items;
|
||||
items.push_back("item 0");
|
||||
items.push_back("item 1");
|
||||
|
||||
//We need this otherwise MSVC complains as it cannot find a suitable append
|
||||
static_cast<wxComboBox*>(m_combo)->Append(items);
|
||||
// TODO: Add wxBitmapComboBoxBase::Append(wxArrayString )
|
||||
for( unsigned int i = 0; i < items.size(); ++i )
|
||||
m_combo->Append(items[i]);
|
||||
|
||||
CPPUNIT_ASSERT(!m_combo->GetItemBitmap(0).IsOk());
|
||||
|
||||
@@ -104,8 +101,10 @@ void BitmapComboBoxTestCase::Bitmap()
|
||||
CPPUNIT_ASSERT(m_combo->GetItemBitmap(0).IsOk());
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(wxSize(16, 16), m_combo->GetBitmapSize());
|
||||
|
||||
m_combo->SetSelection( 1 );
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL( m_combo->GetStringSelection(), "item with bitmap" );
|
||||
}
|
||||
|
||||
#endif //wxGENERIC_BITMAPCOMBOBOX
|
||||
|
||||
#endif //wxUSE_BITMAPCOMBOBOX
|
||||
|
Reference in New Issue
Block a user