xref: /haiku/src/tests/kits/app/bhandler/HandlerLooperTest.cpp (revision 1d9d47fc72028bb71b5f232a877231e59cfe2438)
1 //------------------------------------------------------------------------------
2 //	LooperTest.cpp
3 //
4 //------------------------------------------------------------------------------
5 
6 // Standard Includes -----------------------------------------------------------
7 
8 // System Includes -------------------------------------------------------------
9 #include <Looper.h>
10 
11 // Project Includes ------------------------------------------------------------
12 
13 // Local Includes --------------------------------------------------------------
14 #include "HandlerLooperTest.h"
15 
16 // Local Defines ---------------------------------------------------------------
17 
18 // Globals ---------------------------------------------------------------------
19 
20 //------------------------------------------------------------------------------
21 /**
22 	Looper()
23 	@case		Not added to a BLooper
24 	@results		Returns NULL
25  */
26 void TLooperTest::LooperTest1()
27 {
28 	CPPUNIT_ASSERT(fHandler.Looper() == NULL);
29 }
30 //------------------------------------------------------------------------------
31 /**
32 	Looper()
33 	@case		Add to a BLooper, then remove
34 	@results	Returns the added-to BLooper; when removed, returns NULL
35  */
36 void TLooperTest::LooperTest2()
37 {
38 	BLooper Looper;
39 	Looper.AddHandler(&fHandler);
40 	CPPUNIT_ASSERT(fHandler.Looper() == &Looper);
41 
42 	CPPUNIT_ASSERT(Looper.RemoveHandler(&fHandler));
43 	CPPUNIT_ASSERT(fHandler.Looper() == NULL);
44 }
45 //------------------------------------------------------------------------------
46 Test* TLooperTest::Suite()
47 {
48 	TestSuite* SuiteOfTests = new TestSuite("BHandler::Looper");
49 
50 	ADD_TEST4(BHandler, SuiteOfTests, TLooperTest, LooperTest1);
51 	ADD_TEST4(BHandler, SuiteOfTests, TLooperTest, LooperTest2);
52 
53 	return SuiteOfTests;
54 }
55 //------------------------------------------------------------------------------
56 
57 /*
58  * $Log $
59  *
60  * $Id  $
61  *
62  */
63 
64 
65