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:
parent
7724701025
commit
77a6586a2e
@ -524,7 +524,7 @@ DBG(OUT("BLooper::Quit()\n"));
|
|||||||
name = "no-name";
|
name = "no-name";
|
||||||
}
|
}
|
||||||
printf("ERROR - you must Lock a looper before calling Quit(), "
|
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
|
// Try to lock
|
||||||
@ -580,7 +580,7 @@ message.AddInt32("testfield", 42);
|
|||||||
err = PostMessage(&message);
|
err = PostMessage(&message);
|
||||||
DBG(OUT(" ... done: %lx\n", err));
|
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
|
// because the port is full, so we'll wait a bit and re-post until
|
||||||
// we won't block.
|
// we won't block.
|
||||||
while (err == B_WOULD_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
|
// becomes problematic when the loopers are destroyed: the last looper
|
||||||
// destroyed will have a problem when it tries to delete a filter list that
|
// 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
|
// has already been deleted. In R5, this results in a general protection
|
||||||
// fault; here it ends in a segment violation.
|
// fault. We fix this by checking the filter list for ownership issues.
|
||||||
// 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.
|
|
||||||
if (!IsLocked())
|
if (!IsLocked())
|
||||||
{
|
{
|
||||||
debugger("Owning Looper must be locked before calling "
|
debugger("Owning Looper must be locked before calling "
|
||||||
|
@ -50,6 +50,7 @@ CommonTestLib libapptest.so
|
|||||||
RemoveCommonFilterTest.cpp
|
RemoveCommonFilterTest.cpp
|
||||||
LooperSizeTest.cpp
|
LooperSizeTest.cpp
|
||||||
SetCommonFilterListTest.cpp
|
SetCommonFilterListTest.cpp
|
||||||
|
QuitTest.cpp
|
||||||
|
|
||||||
# BMessageQueue
|
# BMessageQueue
|
||||||
MessageQueueTest.cpp
|
MessageQueueTest.cpp
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "RemoveCommonFilterTest.h"
|
#include "RemoveCommonFilterTest.h"
|
||||||
#include "LooperSizeTest.h"
|
#include "LooperSizeTest.h"
|
||||||
#include "SetCommonFilterListTest.h"
|
#include "SetCommonFilterListTest.h"
|
||||||
|
#include "QuitTest.h"
|
||||||
|
|
||||||
Test* LooperTestSuite()
|
Test* LooperTestSuite()
|
||||||
{
|
{
|
||||||
@ -31,6 +32,7 @@ Test* LooperTestSuite()
|
|||||||
tests->addTest(TRemoveCommonFilterTest::Suite());
|
tests->addTest(TRemoveCommonFilterTest::Suite());
|
||||||
tests->addTest(TLooperSizeTest::Suite());
|
tests->addTest(TLooperSizeTest::Suite());
|
||||||
tests->addTest(TSetCommonFilterListTest::Suite());
|
tests->addTest(TSetCommonFilterListTest::Suite());
|
||||||
|
tests->addTest(TQuitTest::Suite());
|
||||||
|
|
||||||
return tests;
|
return tests;
|
||||||
}
|
}
|
||||||
|
47
src/tests/kits/app/blooper/QuitTest.cpp
Normal file
47
src/tests/kits/app/blooper/QuitTest.cpp
Normal 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 $
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
41
src/tests/kits/app/blooper/QuitTest.h
Normal file
41
src/tests/kits/app/blooper/QuitTest.h
Normal 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 $
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user