]> git.saurik.com Git - wxWidgets.git/commitdiff
Correct wxArrayString::Add return value as per the documentation.
authorMattia Barbon <mbarbon@cpan.org>
Tue, 26 Apr 2005 19:24:12 +0000 (19:24 +0000)
committerMattia Barbon <mbarbon@cpan.org>
Tue, 26 Apr 2005 19:24:12 +0000 (19:24 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33888 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/arrstr.h
tests/arrays/arrays.cpp

index 70bddf1737ba1b60ca278f6b5fb2b3176f21e439..18d7651c4f94d281478beb53e11a903af72cbe68 100644 (file)
@@ -50,6 +50,12 @@ public:
     void Sort(bool reverseOrder = false);
     void Sort(CompareFunction function);
     void Sort(CMPFUNCwxString function) { wxArrayStringBase::Sort(function); }
+
+    size_t Add(const wxString& string, size_t copies = 1)
+    {
+        wxArrayStringBase::Add(string, copies);
+        return size() - copies;
+    }
 };
 
 class WXDLLIMPEXP_BASE wxSortedArrayString : public wxSortedArrayStringBase
index 79c3b97f72d195ba1a5813cf139137ecb1614f22..049fbf09ae081eb086f7ad3df202ac7f406ec82a 100644 (file)
@@ -274,6 +274,16 @@ void ArraysTestCase::wxStringArrayTest()
     CPPUNIT_ASSERT( a1.Index( _T("condor") ) == 2 );
     CPPUNIT_ASSERT( a1.Index( _T("thermit") ) == 3 );
     CPPUNIT_ASSERT( a1.Index( _T("alligator") ) == 4 );
+
+    wxArrayString a5;
+
+    CPPUNIT_ASSERT( a5.Add( _T("x"), 1 ) == 0 );
+    CPPUNIT_ASSERT( a5.Add( _T("a"), 3 ) == 1 );
+
+    CPPUNIT_ASSERT( COMPARE_4_VALUES( a5, _T("x") ,
+                                          _T("a") ,
+                                          _T("a") ,
+                                          _T("a") ) );
 }
 
 void ArraysTestCase::wxObjArrayTest()