xref: /haiku/src/tests/kits/app/broster/BRosterCases (revision 45994f62b8d758c48f0dcd78e7787dae912bf67f)
1BRoster()
2none
3
4bool IsRunning(const char *signature) const
5case 1:	signature is NULL =>
6		Should return false.
7case 2:	signature is not NULL, but no app with this signature is running =>
8		Should return false.
9case 3:	signature is not NULL and an (two) app(s) with this signature is (are)
10		running; quit one; quit the second one =>
11		Should return true; true; false.
12
13bool IsRunning(entry_ref *ref) const
14case 1:	ref is NULL =>
15		Should return false.
16case 2:	ref is not NULL, but no app with this ref is running =>
17		Should return false.
18case 3:	ref is not NULL and an (two) app(s) with this ref is (are)
19		running; quit one; quit the second one =>
20		Should return true; true; false.
21
22team_id TeamFor(const char *signature) const
23case 1:	signature is NULL =>
24		Should return B_BAD_VALUE.
25case 2:	signature is not NULL, but no app with this signature is running =>
26		Should return B_ERROR.
27case 3:	signature is not NULL and an (two) app(s) with this signature is (are)
28		running; quit one; quit the second one =>
29		Should return the ID of one of the teams; the ID of the second team;
30		B_ERROR.
31
32team_id TeamFor(entry_ref *ref) const
33case 1:	ref is NULL =>
34		Should return B_BAD_VALUE.
35case 2:	ref is not NULL, but no app with this ref is running =>
36		Should return B_ERROR.
37case 3:	ref is not NULL and an (two) app(s) with this ref is (are)
38		running; quit one; quit the second one =>
39		Should return the ID of one of the teams; the ID of the second team;
40		B_ERROR.
41
42status_t GetAppInfo(const char *signature, app_info *info) const
43case 1:	signature is NULL or info is NULL =>
44		Should return B_BAD_VALUE.
45case 2:	signature/info are not NULL, but no app with this signature is
46		running =>
47		Should return B_ERROR.
48case 3:	signature/info are not NULL and an (two) app(s) with this signature
49		is (are) running; quit one; quit the second one =>
50		Should
51		- fill the app info with the data of one of the apps and return B_OK;
52		- fill the app info with the data of the second apps and return B_OK;
53		- return B_ERROR.
54
55status_t GetAppInfo(entry_ref *ref, app_info *info) const
56case 1:	ref is NULL or info is NULL =>
57		Should return B_BAD_VALUE.
58case 2:	ref/info are not NULL, but no app with this ref is running =>
59		Should return B_ERROR.
60case 3:	ref/info are not NULL and an (two) app(s) with this ref
61		is (are) running; quit one; quit the second one =>
62		Should
63		- fill the app info with the data of one of the apps and return B_OK;
64		- fill the app info with the data of the second apps and return B_OK;
65		- return B_ERROR.
66
67status_t GetRunningAppInfo(team_id team, app_info *info) const
68case 1:	info is NULL =>
69		Should return B_BAD_VALUE.
70case 2:	info is not NULL, but no app with the team ID is running =>
71		Should return B_BAD_TEAM_ID, if team >= 0, B_ERROR otherwise.
72case 3:	info is not NULL, and an app with the team ID is running =>
73		Should fill the app info and return B_OK.
74
75void GetAppList(BList *teamIDList) const
76case 1:	teamIDList is NULL =>
77		Should do nothing.
78case 2:	teamIDList is not NULL and not empty =>
79		Should append the team IDs of all running apps to teamIDList.
80
81void GetAppList(const char *signature, BList *teamIDList) const
82case 1:	signature or teamIDList are NULL =>
83		Should do nothing/should not modify teamIDList.
84case 2:	teamIDList is not NULL and not empty, signature is not NULL, but no
85		app with this signature is running =>
86		Should not modify teamIDList.
87case 3:	teamIDList is not NULL and not empty, signature is not NULL and
88		app(s) with this signature is (are) running =>
89		Should append the team IDs of all running apps with the supplied
90		signature to teamIDList.
91
92status_t FindApp() const: common cases
93case 1:	uninstalled type mimeType =>
94		Should return B_LAUNCH_FAILED_APP_NOT_FOUND.
95case 2:	installed type mimeType, no preferred app =>
96		Should return B_LAUNCH_FAILED_NO_PREFERRED_APP.
97case 3:	installed type mimeType, preferred app, app type not installed,
98		app has no signature =>
99		Should return B_LAUNCH_FAILED_APP_NOT_FOUND.
100case 4:	installed type mimeType, preferred app, app type not installed,
101		app has signature =>
102		Should return B_OK and set the ref to refer to the application's
103		executable. Should install the app type and set the app hint on it.
104case 5:	installed type mimeType, preferred app, app type installed,
105		app has signature =>
106		Should return B_OK and set the ref to refer to the application's
107		executable. Should set the app hint on the app type.
108case 6:	installed type mimeType, preferred app, app type installed,
109		app has signature, app has no execute permission =>
110		Should return B_OK and set the ref to refer to the application's
111		executable. Should set the app hint on the app type.
112case 7:	installed type mimeType, preferred app, app type installed,
113		two apps have the signature =>
114		Should return B_OK and set the ref to refer to the application
115		executable with the most recent modification time. Should set the app
116		hint on the app type.
117case 8:	installed type mimeType, preferred app, app type installed,
118		two apps have the signature, one has a version info, the other one is
119		newer =>
120		Should return B_OK and set the ref to refer to the application
121		executable with version info. Should set the app hint on the app type.
122case 9:	installed type mimeType, preferred app, app type installed,
123		two apps have the signature, both apps have a version info =>
124		Should return B_OK and set the ref to refer to the application
125		executable with the greater version. Should set the app
126		hint on the app type.
127case 10:installed type mimeType, preferred app, app type installed,
128		preferred app type has an app hint that points to an app with a
129		different signature =>
130		Should return B_OK and set the ref to refer to the application's
131		executable. Should remove the incorrect app hint on the app type.
132		(OBOS: Should set the correct app hint.
133		 Don't even return the wrong app?)
134case 11:installed type mimeType, preferred app, app type installed,
135		preferred app type has an app hint pointing to void,
136		a differently named app with this signature exists =>
137		Should return B_OK and set the ref to refer to the application's
138		executable. (not R5: Should update the app hint on the app type?)
139case 12:mimeType is app signature, not installed =>
140		Should return B_OK and set the ref to refer to the application
141		executable. Should set the app hint on the app type.
142case 13:mimeType is installed, but has no preferred application,
143		super type has preferred application =>
144		Should return B_OK and set the ref to refer to the application
145		executable associated with the preferred app of the supertype.
146		Should set the app hint on the app type.
147case 14:installed type mimeType, preferred app, app type not installed,
148		app has signature, app is trash =>
149		Should return B_LAUNCH_FAILED_APP_IN_TRASH.
150
151status_t FindApp(const char *mimeType, entry_ref *app) const
152case 1:	mimeType or app are NULL =>
153		Should return B_BAD_VALUE.
154case 2:	mimeType is invalid =>
155		Should return B_BAD_VALUE.
156case 3:	common tests (all)
157
158status_t FindApp(entry_ref *ref, entry_ref *app) const
159case 1:	ref or app are NULL =>
160		Should return B_BAD_VALUE.
161case 2:	ref doesn't refer to an existing entry =>
162		Should return B_ENTRY_NOT_FOUND.
163case 3:	ref is valid, file has type and preferred app, preferred app is in
164		trash =>
165		Should return B_LAUNCH_FAILED_APP_IN_TRASH.
166case 4:	ref is valid, file has type and preferred app, app type is not
167		installed, app exists and has signature =>
168		Should return B_OK and set the ref to refer to the file's (not the
169		file type's) preferred application's executable. Should install the
170		app type and set the app hint on it.
171case 5:	ref is valid, file has no type, but preferred app, app type is not
172		installed, app exists and has signature =>
173		Should return B_OK and set the ref to refer to the application's
174		executable. Should install the app type and set the app hint on it.
175case 6:	ref is valid, file has type and app hint, the type's preferred app
176		type is not installed, app exists and has signature =>
177		Should return B_OK and set the ref to refer to the file type's
178		preferred application's executable. Should install the app type and
179		set the app hint on it.
180case 7:	ref is valid, file has type, the type's preferred app
181		type is not installed, app exists and has signature, file is
182		executable =>
183		Should return B_OK and set the ref to refer to the file.
184		Should not set the app hint on the app or file type (Why?).
185case 8:	ref is valid and refers to a link to a file, file has type,
186		the type's preferred app type is not installed,
187		app exists and has signature =>
188		Should return B_OK and set the ref to refer to the file type's
189		preferred application's executable. Should install the app type and
190		set the app hint on it.
191case 9:	ref is valid, file has type,
192		common cases 1-14
193case 10:ref is valid, file has no type, sniffing results in a type,
194		type is set on file,
195		common cases 2-14
196
197status_t Launch() const: common cases
198case 1:	uninstalled type mimeType =>
199		Should return B_LAUNCH_FAILED_APP_NOT_FOUND.
200case 2:	installed type mimeType, no preferred app =>
201		Should return B_LAUNCH_FAILED_NO_PREFERRED_APP.
202case 3:	installed type mimeType, preferred app, app type not installed,
203		app has no signature =>
204		Should return B_LAUNCH_FAILED_APP_NOT_FOUND.
205case 4:	installed type mimeType, preferred app, app type not installed,
206		app has signature =>
207		Should return B_OK and set team to the ID of the team running the
208		application's executable. Should install the app type and set the
209		app hint on it.
210case 5:	installed type mimeType, preferred app, app type installed,
211		app has signature =>
212		Should return B_OK and set team to the ID of the team running the
213		application's executable. Should set the app hint on the app type.
214case 6:	installed type mimeType, preferred app, app type installed,
215		app has signature, app has no execute permission =>
216		Should return B_OK and set team to the ID of the team running the
217		application's executable. Should set the app hint on the app type.
218case 7:	installed type mimeType, preferred app, app type installed,
219		two apps have the signature =>
220		Should return B_OK and set team to the ID of the team running the
221		application executable with the most recent modification time.
222		Should set the app hint on the app type.
223case 8:	installed type mimeType, preferred app, app type installed,
224		two apps have the signature, one has a version info, the other one is
225		newer =>
226		Should return B_OK and set team to the ID of the team running the
227		application executable with version info. Should set the app hint
228		on the app type.
229case 9:	installed type mimeType, preferred app, app type installed,
230		two apps have the signature, both apps have a version info =>
231		Should return B_OK and set team to the ID of the team running the
232		application executable with the greater version. Should set the app
233		hint on the app type.
234case 10:installed type mimeType, preferred app, app type installed,
235		preferred app type has an app hint that points to an app with a
236		different signature =>
237		Should return B_OK and set team to the ID of the team running the
238		application's executable. Should remove the incorrect app hint on
239		the app type.
240		(OBOS: Should set the correct app hint.
241		 Don't even run the wrong app?)
242case 11:installed type mimeType, preferred app, app type installed,
243		preferred app type has an app hint pointing to void,
244		a differently named app with this signature exists =>
245		Should return B_OK and set team to the ID of the team running the
246		application's executable.
247		(not R5: Should update the app hint on the app type?)
248case 12:mimeType is app signature, not installed =>
249		Should return B_OK and set team to the ID of the team running the
250		application executable. Should set the app hint on the app type.
251case 13:mimeType is installed, but has no preferred application,
252		super type has preferred application =>
253		Should return B_OK and set team to the ID of the team running the
254		application executable associated with the preferred app of the
255		supertype. Should set the app hint on the app type.
256case 14:installed type mimeType, preferred app, app type not installed,
257		app has signature, app is trash =>
258		Should return B_LAUNCH_FAILED_APP_IN_TRASH.
259
260status_t Launch(const char *mimeType, BMessage *initialMsg,
261				team_id *appTeam) const
262case 1:	mimeType is NULL =>
263		Should return B_BAD_VALUE.
264case 2:	mimeType is invalid =>
265		Should return B_BAD_VALUE.
266case 3:	common cases (all)
267case 4:	installed type mimeType, preferred app, app type not installed,
268		app has signature, NULL initialMsg =>
269		Should return B_OK and set team to the ID of the team running the
270		application's executable. Should install the app type and set the
271		app hint on it.
272
273
274status_t Launch(const char *mimeType, BList *messageList,
275				team_id *appTeam) const
276case 1:	mimeType is NULL =>
277		Should return B_BAD_VALUE.
278case 2:	mimeType is invalid =>
279		Should return B_BAD_VALUE.
280case 3:	common cases (all)
281case 4:	installed type mimeType, preferred app, app type not installed,
282		app has signature, NULL messageList =>
283		Should return B_OK and set team to the ID of the team running the
284		application's executable. Should install the app type and set the
285		app hint on it.
286case 5:	installed type mimeType, preferred app, app type not installed,
287		app has signature, empty messageList =>
288		Should return B_OK and set team to the ID of the team running the
289		application's executable. Should install the app type and set the
290		app hint on it.
291
292status_t Launch(const char *mimeType, int argc, char **args,
293				team_id *appTeam) const
294case 1:	mimeType is NULL or argc > 0 and args is NULL =>
295		Should return B_BAD_VALUE.
296case 2:	mimeType is invalid =>
297		Should return B_BAD_VALUE.
298case 3:	common cases (all)
299case 4:	installed type mimeType, preferred app, app type not installed,
300		app has signature, NULL args, argc is 0 =>
301		Should return B_OK and set team to the ID of the team running
302		the application's executable. Should install the app type and set the
303		app hint on it.
304
305status_t Launch(const entry_ref *ref, const BMessage *initialMessage,
306				team_id *app_team) const
307case 1:	ref is NULL =>
308		Should return B_BAD_VALUE.
309case 2:	ref doesn't refer to an existing entry =>
310		Should return B_ENTRY_NOT_FOUND.
311case 3:	ref is valid, file has type and preferred app, app type is not
312		installed, app exists and has signature =>
313		Should return B_OK and set team to the ID of the team running the
314		file's (not the file type's) preferred application's executable.
315		Should install the app type and set the app hint on it.
316case 4:	ref is valid, file has no type, but preferred app, app type is not
317		installed, app exists and has signature =>
318		Should return B_OK and set team to the ID of the team running the
319		application's executable. Should install the app type and set the app
320		hint on it.
321case 5:	ref is valid, file has type and app hint, the type's preferred app
322		type is not installed, app exists and has signature =>
323		Should return B_OK and set team to the ID of the team running the file
324		type's preferred application's executable. Should install the app
325		type and set the app hint on it.
326case 6:	ref is valid, file has type, the type's preferred app
327		type is not installed, app exists and has signature, file is
328		executable =>
329		Should return B_LAUNCH_FAILED_EXECUTABLE.
330		Should not set the app hint on the app or file type.
331case 7:	ref is valid and refers to a link to a file, file has type,
332		the type's preferred app type is not installed,
333		app exists and has signature =>
334		Should return B_OK and set team to the ID of the team running the file
335		type's preferred application's executable. Should install the app
336		type and set the app hint on it.
337case 8:	ref is valid, file has type,
338		common cases 1-14
339case 9:	ref is valid, file has no type, sniffing results in a type,
340		type is set on file,
341		common cases 2-14
342case 10:ref is valid, file has no type, but preferred app, app type is not
343		installed, app exists and has signature, NULL initialMessage =>
344		Should return B_OK and set team to the ID of the team running the
345		application's executable. Should install the app type and set the app
346		hint on it.
347
348status_t Launch(const entry_ref *ref, const BList *messageList,
349				team_id *appTeam) const
350case 1:	ref is NULL =>
351		Should return B_BAD_VALUE.
352case 2:	ref doesn't refer to an existing entry =>
353		Should return B_ENTRY_NOT_FOUND.
354case 3:	ref is valid, file has type and preferred app, app type is not
355		installed, app exists and has signature =>
356		Should return B_OK and set team to the ID of the team running the
357		file's (not the file type's) preferred application's executable.
358		Should install the app type and set the app hint on it.
359case 4:	ref is valid, file has no type, but preferred app, app type is not
360		installed, app exists and has signature =>
361		Should return B_OK and set team to the ID of the team running the
362		application's executable. Should install the app type and set the app
363		hint on it.
364case 5:	ref is valid, file has type and app hint, the type's preferred app
365		type is not installed, app exists and has signature =>
366		Should return B_OK and set team to the ID of the team running the file
367		type's preferred application's executable. Should install the app
368		type and set the app hint on it.
369case 6:	ref is valid, file has type, the type's preferred app
370		type is not installed, app exists and has signature, file is
371		executable =>
372		Should return B_LAUNCH_FAILED_EXECUTABLE.
373		Should not set the app hint on the app or file type.
374case 7:	ref is valid and refers to a link to a file, file has type,
375		the type's preferred app type is not installed,
376		app exists and has signature =>
377		Should return B_OK and set team to the ID of the team running the file
378		type's preferred application's executable. Should install the app
379		type and set the app hint on it.
380case 8:	ref is valid, file has type,
381		common cases 1-14
382case 9:	ref is valid, file has no type, sniffing results in a type,
383		type is set on file,
384		common cases 2-14
385case 10:ref is valid, file has no type, but preferred app, app type is not
386		installed, app exists and has signature, NULL messageList =>
387		Should return B_OK and set team to the ID of the team running the
388		application's executable. Should install the app type and set the app
389		hint on it.
390case 11:ref is valid, file has no type, but preferred app, app type is not
391		installed, app exists and has signature, empty messageList =>
392		Should return B_OK and set team to the ID of the team running the
393		application's executable. Should install the app type and set the app
394		hint on it.
395
396status_t Launch(const entry_ref *ref, int argc, const char * const *args,
397				team_id *appTeam) const
398case 1:	ref is NULL =>
399		Should return B_BAD_VALUE.
400case 2:	ref doesn't refer to an existing entry =>
401		Should return B_ENTRY_NOT_FOUND.
402case 3:	ref is valid, file has type and preferred app, app type is not
403		installed, app exists and has signature =>
404		Should return B_OK and set team to the ID of the team running the
405		file's (not the file type's) preferred application's executable.
406		Should install the app type and set the app hint on it.
407		ref is converted to path and added as additional argv.
408case 4:	ref is valid, file has no type, but preferred app, app type is not
409		installed, app exists and has signature =>
410		Should return B_OK and set team to the ID of the team running the
411		application's executable. Should install the app type and set the app
412		hint on it.
413		ref is converted to path and added as additional argv.
414case 5:	ref is valid, file has type and app hint, the type's preferred app
415		type is not installed, app exists and has signature =>
416		Should return B_OK and set team to the ID of the team running the file
417		type's preferred application's executable. Should install the app
418		type and set the app hint on it.
419		ref is converted to path and added as additional argv.
420case 6:	ref is valid, file has type, the type's preferred app
421		type is not installed, app exists and has signature, file is
422		executable =>
423		Should return B_LAUNCH_FAILED_EXECUTABLE.
424		Should not set the app hint on the app or file type.
425case 7:	ref is valid and refers to a link to a file, file has type,
426		the type's preferred app type is not installed,
427		app exists and has signature =>
428		Should return B_OK and set team to the ID of the team running the file
429		type's preferred application's executable. Should install the app
430		type and set the app hint on it.
431		ref is converted to path and added as additional argv.
432case 8:	ref is valid, file has type,
433		common cases 1-14
434		(ref is converted to path and added as additional argv.)
435case 9:	ref is valid, file has no type, sniffing results in a type,
436		type is set on file,
437		common cases 2-14
438		(ref is converted to path and added as additional argv.)
439case 10:ref is valid, file has no type, but preferred app, app type is not
440		installed, app exists and has signature, NULL args, argc is 0 =>
441		Should return B_OK and set team to the ID of the team running the
442		application's executable. Should install the app type and set the app
443		hint on it. argv are ignored.
444case 11:ref is valid, file has no type, but preferred app, app type is not
445		installed, app exists and has signature, NULL args, argc > 0 =>
446		Should return B_OK and set team to the ID of the team running the
447		application's executable. Should install the app type and set the app
448		hint on it. argv are ignored.
449
450