Another test with minor tweaks to BLooper.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@874 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
ejakowatz 2002-08-25 15:44:28 +00:00
parent 7724701025
commit 77a6586a2e
5 changed files with 95 additions and 7 deletions

View File

@ -524,7 +524,7 @@ DBG(OUT("BLooper::Quit()\n"));
name = "no-name";
}
printf("ERROR - you must Lock a looper before calling Quit(), "
"team=%ld, looper=%s", Team(), name);
"team=%ld, looper=%s\n", Team(), name);
}
// Try to lock
@ -580,7 +580,7 @@ message.AddInt32("testfield", 42);
err = PostMessage(&message);
DBG(OUT(" ... done: %lx\n", err));
// There's a possibility that PostMessage() will return B_WILL_BLOCK
// There's a possibility that PostMessage() will return B_WOULD_BLOCK
// because the port is full, so we'll wait a bit and re-post until
// we won't block.
while (err == B_WOULD_BLOCK)
@ -853,11 +853,8 @@ void BLooper::SetCommonFilterList(BList* filters)
// becomes problematic when the loopers are destroyed: the last looper
// destroyed will have a problem when it tries to delete a filter list that
// has already been deleted. In R5, this results in a general protection
// fault; here it ends in a segment violation.
// TODO: Fix
// by checking first filter in list for ownership issues. Go to
// debugger with something like "A MessageFilter can only be used
// once." and return with out setting the list.
// fault. We fix this by checking the filter list for ownership issues.
if (!IsLocked())
{
debugger("Owning Looper must be locked before calling "

View File

@ -50,6 +50,7 @@ CommonTestLib libapptest.so
RemoveCommonFilterTest.cpp
LooperSizeTest.cpp
SetCommonFilterListTest.cpp
QuitTest.cpp
# BMessageQueue
MessageQueueTest.cpp

View File

@ -13,6 +13,7 @@
#include "RemoveCommonFilterTest.h"
#include "LooperSizeTest.h"
#include "SetCommonFilterListTest.h"
#include "QuitTest.h"
Test* LooperTestSuite()
{
@ -31,6 +32,7 @@ Test* LooperTestSuite()
tests->addTest(TRemoveCommonFilterTest::Suite());
tests->addTest(TLooperSizeTest::Suite());
tests->addTest(TSetCommonFilterListTest::Suite());
tests->addTest(TQuitTest::Suite());
return tests;
}

View File

@ -0,0 +1,47 @@
//------------------------------------------------------------------------------
// QuitTest.cpp
//
//------------------------------------------------------------------------------
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <Looper.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
#include "QuitTest.h"
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
//------------------------------------------------------------------------------
/**
Quit()
@case Looper is unlocked
@result
*/
void TQuitTest::QuitTest1()
{
BLooper* Looper = new BLooper;
Looper->Unlock();
Looper->Quit();
}
//------------------------------------------------------------------------------
TestSuite* TQuitTest::Suite()
{
TestSuite* suite = new TestSuite("BLooper::Quit()");
ADD_TEST4(BLooper, suite, TQuitTest, QuitTest1);
return suite;
}
//------------------------------------------------------------------------------
/*
* $Log $
*
* $Id $
*
*/

View File

@ -0,0 +1,41 @@
//------------------------------------------------------------------------------
// QuitTest.h
//
//------------------------------------------------------------------------------
#ifndef QUITTEST_H
#define QUITTEST_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
#include "../common.h"
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
class TQuitTest : public TestCase
{
public:
TQuitTest() {;}
TQuitTest(std::string name) : TestCase(name) {;}
void QuitTest1();
static TestSuite* Suite();
};
#endif //QUITTEST_H
/*
* $Log $
*
* $Id $
*
*/