diff --git a/include/wx/dynarray.h b/include/wx/dynarray.h index 5eced995d9..56abaae013 100644 --- a/include/wx/dynarray.h +++ b/include/wx/dynarray.h @@ -546,6 +546,8 @@ public: \ \ size_t Add(T lItem) \ { return base::Add(lItem, (CMPFUNC)m_fnCompare); } \ + void push_back(T lItem) \ + { Add(lItem); } \ \ void RemoveAt(size_t uiIndex, size_t nRemove = 1) \ { base::erase(begin() + uiIndex, begin() + uiIndex + nRemove); } \ diff --git a/tests/arrays/arrays.cpp b/tests/arrays/arrays.cpp index 4d276963db..8d32cf2a1f 100644 --- a/tests/arrays/arrays.cpp +++ b/tests/arrays/arrays.cpp @@ -160,6 +160,7 @@ public: private: CPPUNIT_TEST_SUITE( ArraysTestCase ); CPPUNIT_TEST( wxStringArrayTest ); + CPPUNIT_TEST( SortedArray ); CPPUNIT_TEST( wxStringArraySplitTest ); CPPUNIT_TEST( wxStringArrayJoinTest ); CPPUNIT_TEST( wxStringArraySplitJoinTest ); @@ -175,6 +176,7 @@ private: CPPUNIT_TEST_SUITE_END(); void wxStringArrayTest(); + void SortedArray(); void wxStringArraySplitTest(); void wxStringArrayJoinTest(); void wxStringArraySplitJoinTest(); @@ -340,6 +342,18 @@ void ArraysTestCase::wxStringArrayTest() CPPUNIT_ASSERT_EQUAL( "Foo", a5[2] ); } +void ArraysTestCase::SortedArray() +{ + wxSortedArrayString a; + a.Add("d"); + a.Add("c"); + CPPUNIT_ASSERT_EQUAL( 0, a.Index("c") ); + + a.push_back("b"); + a.push_back("a"); + CPPUNIT_ASSERT_EQUAL( 0, a.Index("a") ); +} + void ArraysTestCase::wxStringArraySplitTest() { // test wxSplit: