Merge branch 'objarray-ptr-compat'
Restore using object array of pointers broken by recent changes. Closes #18169. See https://github.com/wxWidgets/wxWidgets/pull/856
This commit is contained in:
commit
040e897fdb
@ -652,12 +652,11 @@ private:
|
||||
classdecl wxObjectArrayTraitsFor##name \
|
||||
{ \
|
||||
public: \
|
||||
static T* Clone(const T& item); \
|
||||
static T* Clone(T const& item); \
|
||||
static void Free(T* p); \
|
||||
}; \
|
||||
typedef wxBaseObjectArray<T, wxObjectArrayTraitsFor##name> \
|
||||
wxBaseObjectArrayFor##name; \
|
||||
typedef int (wxCMPFUNC_CONV *CMPFUNC##T)(T **pItem1, T **pItem2); \
|
||||
classdecl name : public wxBaseObjectArrayFor##name \
|
||||
{ \
|
||||
public: \
|
||||
|
@ -95,6 +95,17 @@ WX_DECLARE_OBJARRAY(Bar, ArrayBars);
|
||||
#include "wx/arrimpl.cpp"
|
||||
WX_DEFINE_OBJARRAY(ArrayBars)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// another object array test
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// This code doesn't make any sense, as object arrays should be used with
|
||||
// objects, not pointers, but it used to work, so check that it continues to
|
||||
// compile.
|
||||
WX_DECLARE_OBJARRAY(Bar*, ArrayBarPtrs);
|
||||
#include "wx/arrimpl.cpp"
|
||||
WX_DEFINE_OBJARRAY(ArrayBarPtrs)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// helpers for sorting arrays and comparing items
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -165,6 +176,7 @@ private:
|
||||
CPPUNIT_TEST( wxStringArraySplitJoinTest );
|
||||
|
||||
CPPUNIT_TEST( wxObjArrayTest );
|
||||
CPPUNIT_TEST( wxObjArrayPtrTest );
|
||||
CPPUNIT_TEST( wxArrayUShortTest );
|
||||
CPPUNIT_TEST( wxArrayIntTest );
|
||||
CPPUNIT_TEST( wxArrayCharTest );
|
||||
@ -181,6 +193,7 @@ private:
|
||||
void wxStringArrayJoinTest();
|
||||
void wxStringArraySplitJoinTest();
|
||||
void wxObjArrayTest();
|
||||
void wxObjArrayPtrTest();
|
||||
void wxArrayUShortTest();
|
||||
void wxArrayIntTest();
|
||||
void wxArrayCharTest();
|
||||
@ -567,6 +580,13 @@ void ArraysTestCase::wxObjArrayTest()
|
||||
CPPUNIT_ASSERT_EQUAL( 0, Bar::GetNumber() );
|
||||
}
|
||||
|
||||
void ArraysTestCase::wxObjArrayPtrTest()
|
||||
{
|
||||
// Just check that instantiating this class compiles.
|
||||
ArrayBarPtrs barptrs;
|
||||
CPPUNIT_ASSERT_EQUAL( 0, barptrs.size() );
|
||||
}
|
||||
|
||||
#define TestArrayOf(name) \
|
||||
\
|
||||
void ArraysTestCase::wxArray ## name ## Test() \
|
||||
|
Loading…
Reference in New Issue
Block a user