Finished up tests, accounting for fix in BLooper::AddCommonFilterList() to

prevent adding the same list to two loopers.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@868 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
ejakowatz 2002-08-24 20:36:11 +00:00
parent 858b08a4fb
commit 89c12458ee

View File

@ -22,7 +22,9 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** /**
SetCommonFilterList(BList* filters) SetCommonFilterList(BList* filters)
case NULL list @case NULL list
@param filters NULL
@result CommonFilterList() returns NULL
*/ */
void TSetCommonFilterListTest::SetCommonFilterListTest1() void TSetCommonFilterListTest::SetCommonFilterListTest1()
{ {
@ -33,10 +35,16 @@ void TSetCommonFilterListTest::SetCommonFilterListTest1()
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** /**
SetCommonFilterList(BList* filters) SetCommonFilterList(BList* filters)
case Valid list, looper not locked @case Valid list, looper not locked
@param filters Valid pointer to BList containing BMessageFilter
@result Debugger message: "Owning Looper must be locked before
calling SetCommonFilterList". CommonFilterList() returns
NULL.
*/ */
void TSetCommonFilterListTest::SetCommonFilterListTest2() void TSetCommonFilterListTest::SetCommonFilterListTest2()
{ {
DEBUGGER_ESCAPE;
BLooper Looper; BLooper Looper;
BList* filters = new BList; BList* filters = new BList;
filters->AddItem(new BMessageFilter('1234')); filters->AddItem(new BMessageFilter('1234'));
@ -47,7 +55,9 @@ void TSetCommonFilterListTest::SetCommonFilterListTest2()
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** /**
SetCommonFilterList(BList* filters) SetCommonFilterList(BList* filters)
case Valid list, looper locked @case Valid list, looper locked
@param filters Valid pointer to BList containing BMessageFilter
@result CommonFilterList() returns filters.
*/ */
void TSetCommonFilterListTest::SetCommonFilterListTest3() void TSetCommonFilterListTest::SetCommonFilterListTest3()
{ {
@ -60,11 +70,19 @@ void TSetCommonFilterListTest::SetCommonFilterListTest3()
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** /**
SetCommonFilterList(BList* filters) SetCommonFilterList(BList* filters)
case Valid list, looper locked, owned by another looper @case Valid list, looper locked, owned by another looper
@param filters Valid pointer to BList containing BMessageFilter
@result Looper2.CommonFilterList() returns NULL.
@note R5 implementation segfaults when the first looper is
destroyed (it goes last because it was constructed first)
because it tries to clean up the filter list which has
already been cleaned up by the other looper. Now fixed in
OpenBeOS.
*/ */
void TSetCommonFilterListTest::SetCommonFilterListTest4() void TSetCommonFilterListTest::SetCommonFilterListTest4()
{ {
DEBUGGER_ESCAPE; DEBUGGER_ESCAPE;
BLooper Looper1; BLooper Looper1;
BLooper Looper2; BLooper Looper2;
BList* filters = new BList; BList* filters = new BList;
@ -72,7 +90,11 @@ void TSetCommonFilterListTest::SetCommonFilterListTest4()
Looper1.SetCommonFilterList(filters); Looper1.SetCommonFilterList(filters);
Looper2.SetCommonFilterList(filters); Looper2.SetCommonFilterList(filters);
CPPUNIT_ASSERT(Looper1.CommonFilterList() == filters); CPPUNIT_ASSERT(Looper1.CommonFilterList() == filters);
#ifndef TEST_R5
CPPUNIT_ASSERT(Looper2.CommonFilterList() == NULL);
#else
CPPUNIT_ASSERT(Looper2.CommonFilterList() == filters); CPPUNIT_ASSERT(Looper2.CommonFilterList() == filters);
#endif
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#ifdef ADD_TEST #ifdef ADD_TEST