xref: /haiku/src/tests/kits/app/broster/BRosterCases (revision 66ca3e0417382507770435a94b470019c36a3e89)
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 char *mimeType, entry_ref *app) const
93case 1:	mimeType or app are NULL =>
94		Should return B_BAD_VALUE.
95case 2:	mimeType is invalid =>
96		Should return B_BAD_VALUE.
97case 3:	uninstalled type mimeType =>
98		Should return B_LAUNCH_FAILED_APP_NOT_FOUND.
99case 4:	installed type mimeType, no preferred app =>
100		Should return B_LAUNCH_FAILED_NO_PREFERRED_APP.
101case 5:	installed type mimeType, preferred app, app type not installed,
102		app has no signature =>
103		Should return B_LAUNCH_FAILED_APP_NOT_FOUND.
104case 6:	installed type mimeType, preferred app, app type not installed,
105		app has signature =>
106		Should return B_OK and set the ref to refer to the application's
107		executable. Should install the app type and set the app hint on it.
108case 7:	installed type mimeType, preferred app, app type installed,
109		app has signature =>
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 8:	installed type mimeType, preferred app, app type installed,
113		app has signature, app has no execute permission =>
114		Should return B_OK and set the ref to refer to the application's
115		executable. Should set the app hint on the app type.
116case 9:	installed type mimeType, preferred app, app type installed,
117		two apps have the signature =>
118		Should return B_OK and set the ref to refer to the application
119		executable with the most recent modification time. Should set the app
120		hint on the app type.
121case 10:installed type mimeType, preferred app, app type installed,
122		two apps have the signature, one has a version info, the other one is
123		newer =>
124		Should return B_OK and set the ref to refer to the application
125		executable with version info. Should set the app hint on the app type.
126case 11:installed type mimeType, preferred app, app type installed,
127		two apps have the signature, both apps have a version info =>
128		Should return B_OK and set the ref to refer to the application
129		executable with the greater version. Should set the app
130		hint on the app type.
131case 12:installed type mimeType, preferred app, app type installed,
132		preferred app type has an app hint that points to an app with a
133		different signature =>
134		Should return B_OK and set the ref to refer to the application's
135		executable. Should remove the incorrect app hint on the app type.
136		(OBOS: Should set the correct app hint.
137		 Don't even return the wrong app?)
138case 13:installed type mimeType, preferred app, app type installed,
139		preferred app type has an app hint pointing to void,
140		a differently named app with this signature exists =>
141		Should return B_OK and set the ref to refer to the application's
142		executable. (not R5: Should update the app hint on the app type?)
143case 14:mimeType is app signature, not installed =>
144		Should return B_OK and set the ref to refer to the application
145		executable. Should set the app hint on the app type.
146case 15:mimeType is installed, but has no preferred application,
147		super type has preferred application =>
148		Should return B_OK and set the ref to refer to the application
149		executable associated with the preferred app of the supertype.
150		Should set the app hint on the app type.
151case 16:installed type mimeType, preferred app, app type not installed,
152		app has signature, app is trash =>
153		Should return B_LAUNCH_FAILED_APP_IN_TRASH.
154
155status_t FindApp(entry_ref *ref, entry_ref *app) const
156case 1:	ref or app are NULL =>
157		Should return B_BAD_VALUE.
158case 2:	ref doesn't refer to an existing entry =>
159		Should return B_ENTRY_NOT_FOUND.
160case 3:	ref is valid, file has type and preferred app, preferred app is in
161		trash =>
162		Should return B_LAUNCH_FAILED_APP_IN_TRASH.
163case 4:	ref is valid, file has type and preferred app, app type is not
164		installed, app exists and has signature =>
165		Should return B_OK and set the ref to refer to the file's (not the
166		file type's) preferred application's executable. Should install the
167		app type and set the app hint on it.
168case 5:	ref is valid, file has no type, but preferred app, app type is not
169		installed, app exists and has signature =>
170		Should return B_OK and set the ref to refer to the application's
171		executable. Should install the app type and set the app hint on it.
172case 6:	ref is valid, file has type and app hint, the type's preferred app
173		type is not installed, app exists and has signature =>
174		Should return B_OK and set the ref to refer to the file type's
175		preferred application's executable. Should install the app type and
176		set the app hint on it.
177case 7:	ref is valid, file has type, the type's preferred app
178		type is not installed, app exists and has signature, file is
179		executable =>
180		Should return B_OK and set the ref to refer to the file.
181		Should not set the app hint on the app or file type (Why?).
182case 8:	ref is valid and refers to a link to a file, file has type,
183		the type's preferred app type is not installed,
184		app exists and has signature =>
185		Should return B_OK and set the ref to refer to the file type's
186		preferred application's executable. Should install the app type and
187		set the app hint on it.
188case 9:	ref is valid, file has type,
189		FindApp(const char*, entry_ref*) cases 3-16 (== common cases 1-14)
190case 10:ref is valid, file has no type, sniffing results in a type,
191		type is set on file,
192		FindApp(const char*, entry_ref*) cases 4-16 (== common cases 2-14)
193
194
195