예제 #1
0
void
TQuitTest::QuitTest2()
{
	BLooper* looper = new BLooper;
	looper->Run();

	BMessage reply;
	BMessenger(looper).SendMessage(B_QUIT_REQUESTED, &reply);
}
예제 #2
0
/*
	bool IsTargetLocal() const
	@case 2			this is initialized to local target with preferred handler
	@results		should return true.
 */
void TargetTester::IsTargetLocalTest2()
{
	status_t result = B_OK;
	BLooper *looper = new BLooper;
	looper->Run();
	LooperQuitter quitter(looper);
	BMessenger messenger(NULL, looper, &result);
	CHK(messenger.IsTargetLocal() == true);
}
예제 #3
0
/*
	BHandler *Target(BLooper **looper) const
	@case 2			this is initialized to local target with preferred handler,
					looper is NULL
	@results		should return NULL.
 */
void TargetTester::TargetTest2()
{
	status_t result = B_OK;
	BLooper *looper = new BLooper;
	looper->Run();
	LooperQuitter quitter(looper);
	BMessenger messenger(NULL, looper, &result);
	CHK(messenger.Target(NULL) == NULL);
}
/*
	bool operator==(const BMessenger &other) const
	bool operator!=(const BMessenger &a, const BMessenger &b)
	@case 1			this (a) is initialized, other (b) is uninitialized,
					and vice versa
	@results		should return false/true.
 */
void MessengerComparissonTester::ComparissonTest2()
{
	// create looper
	BLooper *looper = new BLooper;
	looper->Run();
	LooperQuitter quitter(looper);
	// create messenger
	BMessenger a(NULL, looper);
	BMessenger b;
	CHK(a != b);
	CHK(b != a);
	CHK(!(a == b));
	CHK(!(b == a));
}
예제 #5
0
/*
	bool IsTargetLocal() const
	@case 3			this is initialized to local target with specific handler
	@results		should return true.
 */
void TargetTester::IsTargetLocalTest3()
{
	// create looper and handler
	status_t result = B_OK;
	BLooper *looper = new BLooper;
	looper->Run();
	LooperQuitter quitter(looper);
	BHandler *handler = new BHandler;
	HandlerDeleter deleter(handler);
	CHK(looper->Lock());
	looper->AddHandler(handler);
	looper->Unlock();
	// create the messenger and do the checks
	BMessenger messenger(handler, NULL, &result);
	CHK(messenger.IsTargetLocal() == true);
}