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:
oneeyeman1
2020-09-23 03:01:02 -05:00
committed by Vadim Zeitlin
parent 1f0ade29f0
commit 61ef150044
3 changed files with 14 additions and 8 deletions

View File

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