xref: /haiku/src/tests/kits/app/bmessagerunner/BMessageRunnerCases (revision dace24c6255b30ff7f266dd08e43441f517851d3)
1*dace24c6SIngo WeinholdBMessageRunner(BMessenger target, const BMessage *message, bigtime_t interval,
2*dace24c6SIngo Weinhold			   int32 count)
3*dace24c6SIngo Weinholdcase 1:	target is invalid, message is valid, interval > 0, count > 0 =>
4*dace24c6SIngo Weinhold		InitCheck() should return B_OK. The message runner turns to unusable
5*dace24c6SIngo Weinhold		as soon as the first message had to be sent.
6*dace24c6SIngo Weinhold		GetInfo() should return B_OK.
7*dace24c6SIngo Weinholdcase 2:	target is valid, message is NULL, interval > 0, count > 0 =>
8*dace24c6SIngo Weinhold		InitCheck() should return B_BAD_VALUE.
9*dace24c6SIngo Weinhold		GetInfo() should return B_BAD_VALUE.
10*dace24c6SIngo Weinholdcase 3:	target is valid, message is valid, interval == 0, count > 0 =>
11*dace24c6SIngo Weinhold		R5: InitCheck() should return B_ERROR.
12*dace24c6SIngo Weinhold			GetInfo() should return B_BAD_VALUE.
13*dace24c6SIngo Weinhold		OBOS: InitCheck() should return B_OK.
14*dace24c6SIngo Weinhold			  GetInfo() should return B_OK.
15*dace24c6SIngo Weinhold			  A minimal time interval is used (50000).
16*dace24c6SIngo Weinholdcase 4:	target is valid, message is valid, interval < 0, count > 0 =>
17*dace24c6SIngo Weinhold		InitCheck() should return B_OK.
18*dace24c6SIngo Weinhold		GetInfo() should return B_OK.
19*dace24c6SIngo Weinhold		A minimal time interval is used (50000).
20*dace24c6SIngo Weinholdcase 5:	target is valid, message is valid, interval == LONGLONG_MAX,
21*dace24c6SIngo Weinhold		count > 0 =>
22*dace24c6SIngo Weinhold		InitCheck() should return B_OK.
23*dace24c6SIngo Weinhold		GetInfo() should return B_OK.
24*dace24c6SIngo Weinhold		No message should be delivered.
25*dace24c6SIngo Weinholdcase 6:	target is valid, message is valid, interval > 0, count == 0 =>
26*dace24c6SIngo Weinhold		InitCheck() should return B_ERROR.
27*dace24c6SIngo Weinhold		GetInfo() should return B_BAD_VALUE.
28*dace24c6SIngo Weinholdcase 7:	target is valid, message is valid, interval > 0, count < 0 =>
29*dace24c6SIngo Weinhold		InitCheck() should return B_OK.
30*dace24c6SIngo Weinhold		GetInfo() should return B_OK.
31*dace24c6SIngo Weinhold		Unlimited number of messages.
32*dace24c6SIngo Weinholdcase 8:	target is valid, message is valid, interval > 0, count > 0 =>
33*dace24c6SIngo Weinhold		InitCheck() should return B_OK.
34*dace24c6SIngo Weinhold		GetInfo() should return B_OK.
35*dace24c6SIngo Weinhold		count messages are sent.
36*dace24c6SIngo Weinhold
37*dace24c6SIngo WeinholdBMessageRunner(BMessenger target, const BMessage *message,
38*dace24c6SIngo Weinhold			   bigtime_t interval, int32 count, BMessenger replyTo)
39*dace24c6SIngo Weinholdcases 1-8 from first constructor
40*dace24c6SIngo Weinholdcase 9:	target is valid, message is valid, interval > 0, count > 0,
41*dace24c6SIngo Weinhold		replyTo is invalid =>
42*dace24c6SIngo Weinhold		InitCheck() should return B_OK.
43*dace24c6SIngo Weinhold		GetInfo() should return B_OK.
44*dace24c6SIngo Weinhold		count messages are sent. The replies go to the registrar!
45*dace24c6SIngo Weinholdcase 10:target is valid, message is valid, interval > 0, count > 0,
46*dace24c6SIngo Weinhold		replyTo targets a different handler than be_app_messenger =>
47*dace24c6SIngo Weinhold		InitCheck() should return B_OK.
48*dace24c6SIngo Weinhold		GetInfo() should return B_OK.
49*dace24c6SIngo Weinhold		count messages are sent. The replies go to the handler.
50*dace24c6SIngo Weinhold
51*dace24c6SIngo Weinholdstatus_t SetInterval(bigtime_t interval)
52*dace24c6SIngo Weinholdcase 1:	object is not properly initialized, interval > 0 =>
53*dace24c6SIngo Weinhold		Should return B_BAD_VALUE.
54*dace24c6SIngo Weinhold		InitCheck() should return B_ERROR.
55*dace24c6SIngo Weinhold		GetInfo() should return B_BAD_VALUE.
56*dace24c6SIngo Weinholdcase 2:	object was properly initialized, but has already delivered all its
57*dace24c6SIngo Weinhold		messages and thus became unusable, interval > 0 =>
58*dace24c6SIngo Weinhold		Should return B_BAD_VALUE.
59*dace24c6SIngo Weinhold		InitCheck() should return B_OK.
60*dace24c6SIngo Weinhold		GetInfo() should return B_BAD_VALUE.
61*dace24c6SIngo Weinholdcase 3:	object is properly initialized and has still one message to deliver,
62*dace24c6SIngo Weinhold		interval > 0 =>
63*dace24c6SIngo Weinhold		Should return B_OK.
64*dace24c6SIngo Weinhold		InitCheck() should return B_OK.
65*dace24c6SIngo Weinhold		GetInfo() should return B_OK and the new interval.
66*dace24c6SIngo Weinhold		The timer is reset. The last message arives after the time specified
67*dace24c6SIngo Weinhold		by interval has passed.
68*dace24c6SIngo Weinholdcase 4:	object is properly initialized and has still some messages to deliver,
69*dace24c6SIngo Weinhold		interval > 0 =>
70*dace24c6SIngo Weinhold		Should return B_OK.
71*dace24c6SIngo Weinhold		InitCheck() should return B_OK.
72*dace24c6SIngo Weinhold		GetInfo() should return B_OK and the new interval.
73*dace24c6SIngo Weinhold		The timer is reset. The messages start to arive after the time
74*dace24c6SIngo Weinhold		specified by interval.
75*dace24c6SIngo Weinholdcase 5:	object is properly initialized and has still an unlimited number of
76*dace24c6SIngo Weinhold		messages to deliver, interval > 0 =>
77*dace24c6SIngo Weinhold		Should return B_OK.
78*dace24c6SIngo Weinhold		InitCheck() should return B_OK.
79*dace24c6SIngo Weinhold		GetInfo() should return B_OK and the new interval.
80*dace24c6SIngo Weinhold		The timer is reset. The messages start to arive after the time
81*dace24c6SIngo Weinhold		specified by interval.
82*dace24c6SIngo Weinholdcase 6:	object is properly initialized and has still some messages to deliver,
83*dace24c6SIngo Weinhold		interval == 0 =>
84*dace24c6SIngo Weinhold		Should return B_OK.
85*dace24c6SIngo Weinhold		InitCheck() should return B_OK.
86*dace24c6SIngo Weinhold		R5: GetInfo() should return B_BAD_VALUE.
87*dace24c6SIngo Weinhold			All messages are delivered, but at weird times.
88*dace24c6SIngo Weinhold		OBOS: GetInfo() should return B_OK and the minimal interval.
89*dace24c6SIngo Weinhold			  The timer is reset. The messages start to arive after the time
90*dace24c6SIngo Weinhold			  specified by the minimal interval.
91*dace24c6SIngo Weinholdcase 7:	object is properly initialized and has still some messages to deliver,
92*dace24c6SIngo Weinhold		interval < 0 =>
93*dace24c6SIngo Weinhold		Should return B_OK.
94*dace24c6SIngo Weinhold		InitCheck() should return B_OK.
95*dace24c6SIngo Weinhold		R5: GetInfo() should return B_BAD_VALUE.
96*dace24c6SIngo Weinhold			All messages are delivered, but at weird times.
97*dace24c6SIngo Weinhold		OBOS: GetInfo() should return B_OK and the minimal interval.
98*dace24c6SIngo Weinhold			  The timer is reset. The messages start to arive after the time
99*dace24c6SIngo Weinhold			  specified by the minimal interval.
100*dace24c6SIngo Weinhold
101*dace24c6SIngo Weinholdstatus_t SetCount(int32 count)
102*dace24c6SIngo Weinholdcase 1:	object is not properly initialized, count > 0 =>
103*dace24c6SIngo Weinhold		Should return B_BAD_VALUE.
104*dace24c6SIngo Weinhold		InitCheck() should return B_ERROR.
105*dace24c6SIngo Weinhold		GetInfo() should return B_BAD_VALUE.
106*dace24c6SIngo Weinholdcase 2:	object was properly initialized, but has already delivered all its
107*dace24c6SIngo Weinhold		messages and thus became unusable, count > 0 =>
108*dace24c6SIngo Weinhold		Should return B_BAD_VALUE.
109*dace24c6SIngo Weinhold		InitCheck() should return B_OK.
110*dace24c6SIngo Weinhold		GetInfo() should return B_BAD_VALUE.
111*dace24c6SIngo Weinholdcase 3:	object is properly initialized and has still one message to deliver,
112*dace24c6SIngo Weinhold		count > 0 =>
113*dace24c6SIngo Weinhold		Should return B_OK.
114*dace24c6SIngo Weinhold		InitCheck() should return B_OK.
115*dace24c6SIngo Weinhold		GetInfo() should return B_OK and the new count.
116*dace24c6SIngo Weinhold		The timer is NOT reset. count messages should arrive.
117*dace24c6SIngo Weinholdcase 4:	object is properly initialized and has still some messages to deliver,
118*dace24c6SIngo Weinhold		count > 0 =>
119*dace24c6SIngo Weinhold		Should return B_OK.
120*dace24c6SIngo Weinhold		InitCheck() should return B_OK.
121*dace24c6SIngo Weinhold		GetInfo() should return B_OK and the new count.
122*dace24c6SIngo Weinhold		The timer is NOT reset. count messages should arrive.
123*dace24c6SIngo Weinholdcase 5:	object is properly initialized and has still an unlimited number of
124*dace24c6SIngo Weinhold		messages to deliver, count > 0 =>
125*dace24c6SIngo Weinhold		Should return B_OK.
126*dace24c6SIngo Weinhold		InitCheck() should return B_OK.
127*dace24c6SIngo Weinhold		GetInfo() should return B_OK and the new count.
128*dace24c6SIngo Weinhold		The timer is NOT reset. count messages should arrive.
129*dace24c6SIngo Weinholdcase 6:	object is properly initialized and has still some messages to deliver,
130*dace24c6SIngo Weinhold		count == 0 =>
131*dace24c6SIngo Weinhold		Should return B_OK.
132*dace24c6SIngo Weinhold		InitCheck() should return B_OK.
133*dace24c6SIngo Weinhold		R5: GetInfo() should return B_OK and count 0!
134*dace24c6SIngo Weinhold			The timer is NOT reset and a message arives after the time specified
135*dace24c6SIngo Weinhold			by the interval!
136*dace24c6SIngo Weinhold		OBOS: GetInfo() should return B_BAD_VALUE.
137*dace24c6SIngo Weinholdcase 7:	object is properly initialized and has still some messages to deliver,
138*dace24c6SIngo Weinhold		count < 0 =>
139*dace24c6SIngo Weinhold		Should return B_OK.
140*dace24c6SIngo Weinhold		InitCheck() should return B_OK.
141*dace24c6SIngo Weinhold		GetInfo() should return B_OK and the new count.
142*dace24c6SIngo Weinhold		The timer is NOT reset. Unlimited number of messages.
143