From 89c12458eebdb6ecf55b796d140414120dc5c1af Mon Sep 17 00:00:00 2001 From: ejakowatz Date: Sat, 24 Aug 2002 20:36:11 +0000 Subject: [PATCH] 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 --- .../app/blooper/SetCommonFilterListTest.cpp | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/tests/kits/app/blooper/SetCommonFilterListTest.cpp b/src/tests/kits/app/blooper/SetCommonFilterListTest.cpp index 931bc242fa..f055542517 100644 --- a/src/tests/kits/app/blooper/SetCommonFilterListTest.cpp +++ b/src/tests/kits/app/blooper/SetCommonFilterListTest.cpp @@ -22,7 +22,9 @@ //------------------------------------------------------------------------------ /** SetCommonFilterList(BList* filters) - case NULL list + @case NULL list + @param filters NULL + @result CommonFilterList() returns NULL */ void TSetCommonFilterListTest::SetCommonFilterListTest1() { @@ -33,10 +35,16 @@ void TSetCommonFilterListTest::SetCommonFilterListTest1() //------------------------------------------------------------------------------ /** 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() { + DEBUGGER_ESCAPE; + BLooper Looper; BList* filters = new BList; filters->AddItem(new BMessageFilter('1234')); @@ -47,7 +55,9 @@ void TSetCommonFilterListTest::SetCommonFilterListTest2() //------------------------------------------------------------------------------ /** 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() { @@ -60,11 +70,19 @@ void TSetCommonFilterListTest::SetCommonFilterListTest3() //------------------------------------------------------------------------------ /** 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() { DEBUGGER_ESCAPE; + BLooper Looper1; BLooper Looper2; BList* filters = new BList; @@ -72,7 +90,11 @@ void TSetCommonFilterListTest::SetCommonFilterListTest4() Looper1.SetCommonFilterList(filters); Looper2.SetCommonFilterList(filters); CPPUNIT_ASSERT(Looper1.CommonFilterList() == filters); +#ifndef TEST_R5 + CPPUNIT_ASSERT(Looper2.CommonFilterList() == NULL); +#else CPPUNIT_ASSERT(Looper2.CommonFilterList() == filters); +#endif } //------------------------------------------------------------------------------ #ifdef ADD_TEST