author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 24 Nov 2009 08:56:33 +0200 | |
changeset 33 | 50974a8b132e |
parent 19 | 989d2f495d90 |
permissions | -rw-r--r-- |
19 | 1 |
/* |
2 |
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: ?Description |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
||
21 |
// INCLUDE FILES |
|
22 |
#include <e32svr.h> |
|
23 |
#include <StifParser.h> |
|
24 |
//#include <SAPI_TEST\testprg.h> |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
25 |
#include <StifTestInterface.h> |
19 | 26 |
|
27 |
#include "tcalendardeletetest.h" |
|
28 |
||
29 |
#include "caldeltestcases.h" |
|
30 |
||
31 |
#include "calendarservice.h" |
|
32 |
||
33 |
// ============================ MEMBER FUNCTIONS =============================== |
|
34 |
||
35 |
// ----------------------------------------------------------------------------- |
|
36 |
// CTChangeStatusTest::Delete |
|
37 |
// Delete here all resources allocated and opened from test methods. |
|
38 |
// Called from destructor. |
|
39 |
// ----------------------------------------------------------------------------- |
|
40 |
// |
|
41 |
void CTCalendarDeleteTest::Delete() |
|
42 |
{ |
|
43 |
||
44 |
} |
|
45 |
||
46 |
// ----------------------------------------------------------------------------- |
|
47 |
// CTChangeStatusTest::RunMethodL |
|
48 |
// Run specified method. Contains also table of test mothods and their names. |
|
49 |
// ----------------------------------------------------------------------------- |
|
50 |
// |
|
51 |
TInt CTCalendarDeleteTest::RunMethodL( |
|
52 |
CStifItemParser& aItem ) |
|
53 |
{ |
|
54 |
||
55 |
static TStifFunctionInfo const KFunctions[] = |
|
56 |
{ |
|
57 |
// Copy this line for every implemented function. |
|
58 |
// First string is the function name used in TestScripter script file. |
|
59 |
// Second is the actual implementation member function. |
|
60 |
//TRY( "SendMessage", CTDeleteMessageTest::SendMessage ), |
|
61 |
||
62 |
ENTRY( "DeleteCalendar", CTCalendarDeleteTest::DeleteCalendar), |
|
63 |
ENTRY( "DeleteDefaultCalendar", CTCalendarDeleteTest::DeleteDefaultCalendar), |
|
64 |
ENTRY( "DeleteAllEntries", CTCalendarDeleteTest::DeleteAllEntries), |
|
65 |
ENTRY( "DeleteUsingGUid", CTCalendarDeleteTest::DeleteUsingGUid), |
|
66 |
ENTRY( "DeleteUsingLocalUid", CTCalendarDeleteTest::DeleteUsingLocalUid), |
|
67 |
ENTRY( "DeleteTmRgLocalUid", CTCalendarDeleteTest::DeleteTmRgLocalUid), |
|
68 |
ENTRY( "DeleteTmRgGUid", CTCalendarDeleteTest::DeleteTmRgGUid), |
|
69 |
ENTRY( "DeleteTmRg", CTCalendarDeleteTest::DeleteTmRg), |
|
70 |
||
71 |
ENTRY( "DeleteAllEntriesAsync", CTCalendarDeleteTest::DeleteAllEntriesAsync), |
|
72 |
ENTRY( "DeleteUsingGUidAsync", CTCalendarDeleteTest::DeleteUsingGUidAsync), |
|
73 |
ENTRY( "DeleteUsingLocalUidAsync", CTCalendarDeleteTest::DeleteUsingLocalUidAsync), |
|
74 |
ENTRY( "DeleteTmRgLocalUidAsync", CTCalendarDeleteTest::DeleteTmRgLocalUidAsync), |
|
75 |
ENTRY( "DeleteTmRgGUidAsync", CTCalendarDeleteTest::DeleteTmRgGUidAsync), |
|
76 |
ENTRY( "DeleteTmRgAsync", CTCalendarDeleteTest::DeleteTmRgAsync), |
|
77 |
}; |
|
78 |
||
79 |
const TInt count = sizeof( KFunctions ) / |
|
80 |
sizeof( TStifFunctionInfo ); |
|
81 |
||
82 |
return RunInternalL( KFunctions, count, aItem ); |
|
83 |
||
84 |
} |
|
85 |
||
86 |
||
87 |
TInt CTCalendarDeleteTest::DeleteCalendar(CStifItemParser & /*aItem*/ ) |
|
88 |
{ |
|
89 |
TInt result = KErrNone; |
|
90 |
__UHEAP_MARK; |
|
91 |
CCalDelTestCases *calDelTest = CCalDelTestCases::NewL(result); |
|
92 |
||
93 |
CleanupStack::PushL( calDelTest ); |
|
94 |
||
95 |
calDelTest->TestDeleteCalendarL(); |
|
96 |
||
97 |
CleanupStack::PopAndDestroy( calDelTest ); |
|
98 |
__UHEAP_MARKEND; |
|
99 |
return result; |
|
100 |
} |
|
101 |
||
102 |
TInt CTCalendarDeleteTest::DeleteDefaultCalendar(CStifItemParser & /*aItem*/ ) |
|
103 |
{ |
|
104 |
TInt result = KErrNone; |
|
105 |
__UHEAP_MARK; |
|
106 |
CCalDelTestCases *calDelTest = CCalDelTestCases::NewL(result); |
|
107 |
||
108 |
CleanupStack::PushL( calDelTest ); |
|
109 |
||
110 |
calDelTest->TestDeleteDefaultCalendarL(); |
|
111 |
||
112 |
CleanupStack::PopAndDestroy( calDelTest ); |
|
113 |
__UHEAP_MARKEND; |
|
114 |
return result; |
|
115 |
} |
|
116 |
||
117 |
_LIT(KDelTestCalName ,"c:deletethiscalender"); |
|
118 |
||
119 |
void removeCalendarFileL() |
|
120 |
{ |
|
121 |
CCalendarService *service = CCalendarService::NewL(); |
|
122 |
||
123 |
CleanupStack::PushL( service ); |
|
124 |
||
125 |
TRAPD( err , service->DeleteL( KDelTestCalName.operator()() ) ); |
|
126 |
||
127 |
CleanupStack::PopAndDestroy( service ); |
|
128 |
} |
|
129 |
||
130 |
TInt CTCalendarDeleteTest::DeleteAllEntries(CStifItemParser & /*aItem*/ ) |
|
131 |
{ |
|
132 |
TInt result = KErrNone; |
|
133 |
__UHEAP_MARK; |
|
134 |
removeCalendarFileL(); |
|
135 |
||
136 |
CCalDelTestCases *calDelTest = CCalDelTestCases::NewL(result); |
|
137 |
||
138 |
CleanupStack::PushL( calDelTest ); |
|
139 |
||
140 |
calDelTest->TestDeleteAllEntriesL(); |
|
141 |
||
142 |
CleanupStack::PopAndDestroy( calDelTest ); |
|
143 |
||
144 |
removeCalendarFileL(); |
|
145 |
__UHEAP_MARKEND; |
|
146 |
return result; |
|
147 |
} |
|
148 |
||
149 |
TInt CTCalendarDeleteTest::DeleteUsingGUid(CStifItemParser & /*aItem*/ ) |
|
150 |
{ |
|
151 |
TInt result = KErrNone; |
|
152 |
__UHEAP_MARK; |
|
153 |
removeCalendarFileL(); |
|
154 |
||
155 |
CCalDelTestCases *calDelTest = CCalDelTestCases::NewL(result); |
|
156 |
||
157 |
CleanupStack::PushL( calDelTest ); |
|
158 |
||
159 |
calDelTest->TestDeleteUsingGUidL(); |
|
160 |
||
161 |
CleanupStack::PopAndDestroy( calDelTest ); |
|
162 |
||
163 |
removeCalendarFileL(); |
|
164 |
__UHEAP_MARKEND; |
|
165 |
return result; |
|
166 |
} |
|
167 |
||
168 |
||
169 |
TInt CTCalendarDeleteTest::DeleteUsingLocalUid(CStifItemParser & /*aItem*/ ) |
|
170 |
{ |
|
171 |
TInt result = KErrNone; |
|
172 |
__UHEAP_MARK; |
|
173 |
removeCalendarFileL(); |
|
174 |
||
175 |
CCalDelTestCases *calDelTest = CCalDelTestCases::NewL(result); |
|
176 |
||
177 |
CleanupStack::PushL( calDelTest ); |
|
178 |
||
179 |
calDelTest->TestDeleteUsingLocalUidL(); |
|
180 |
||
181 |
CleanupStack::PopAndDestroy( calDelTest ); |
|
182 |
||
183 |
removeCalendarFileL(); |
|
184 |
__UHEAP_MARKEND; |
|
185 |
return result; |
|
186 |
} |
|
187 |
||
188 |
||
189 |
TInt CTCalendarDeleteTest::DeleteTmRgLocalUid(CStifItemParser & /*aItem*/ ) |
|
190 |
{ |
|
191 |
TInt result = KErrNone; |
|
192 |
__UHEAP_MARK; |
|
193 |
removeCalendarFileL(); |
|
194 |
||
195 |
CCalDelTestCases *calDelTest = CCalDelTestCases::NewL(result); |
|
196 |
||
197 |
CleanupStack::PushL( calDelTest ); |
|
198 |
||
199 |
calDelTest->TestDeleteTmRgLocalUidL(); |
|
200 |
||
201 |
CleanupStack::PopAndDestroy( calDelTest ); |
|
202 |
||
203 |
removeCalendarFileL(); |
|
204 |
__UHEAP_MARKEND; |
|
205 |
return result; |
|
206 |
} |
|
207 |
||
208 |
||
209 |
TInt CTCalendarDeleteTest::DeleteTmRgGUid(CStifItemParser & /*aItem*/ ) |
|
210 |
{ |
|
211 |
TInt result = KErrNone; |
|
212 |
__UHEAP_MARK; |
|
213 |
removeCalendarFileL(); |
|
214 |
||
215 |
CCalDelTestCases *calDelTest = CCalDelTestCases::NewL(result); |
|
216 |
||
217 |
CleanupStack::PushL( calDelTest ); |
|
218 |
||
219 |
calDelTest->TestDeleteTmRgGUidL(); |
|
220 |
||
221 |
CleanupStack::PopAndDestroy( calDelTest ); |
|
222 |
||
223 |
removeCalendarFileL(); |
|
224 |
__UHEAP_MARKEND; |
|
225 |
return result; |
|
226 |
} |
|
227 |
||
228 |
||
229 |
TInt CTCalendarDeleteTest::DeleteTmRg(CStifItemParser & /*aItem*/ ) |
|
230 |
{ |
|
231 |
TInt result = KErrNone; |
|
232 |
__UHEAP_MARK; |
|
233 |
removeCalendarFileL(); |
|
234 |
||
235 |
CCalDelTestCases *calDelTest = CCalDelTestCases::NewL(result); |
|
236 |
||
237 |
CleanupStack::PushL( calDelTest ); |
|
238 |
||
239 |
calDelTest->TestDeleteTmRgL(); |
|
240 |
||
241 |
CleanupStack::PopAndDestroy( calDelTest ); |
|
242 |
||
243 |
removeCalendarFileL(); |
|
244 |
__UHEAP_MARKEND; |
|
245 |
return result; |
|
246 |
} |
|
247 |
||
248 |
//Async things starts here ************************************************** |
|
249 |
||
250 |
TInt CTCalendarDeleteTest::DeleteAllEntriesAsync(CStifItemParser & /*aItem*/ ) |
|
251 |
{ |
|
252 |
TInt result = KErrNone; |
|
253 |
__UHEAP_MARK; |
|
254 |
removeCalendarFileL(); |
|
255 |
||
256 |
CCalDelTestCases *calDelTest = CCalDelTestCases::NewL(result); |
|
257 |
||
258 |
CleanupStack::PushL( calDelTest ); |
|
259 |
||
260 |
calDelTest->TestDeleteAllEntriesAsyncL(); |
|
261 |
||
262 |
CleanupStack::PopAndDestroy( calDelTest ); |
|
263 |
||
264 |
removeCalendarFileL(); |
|
265 |
__UHEAP_MARKEND; |
|
266 |
return result; |
|
267 |
} |
|
268 |
||
269 |
TInt CTCalendarDeleteTest::DeleteUsingGUidAsync(CStifItemParser & /*aItem*/ ) |
|
270 |
{ |
|
271 |
TInt result = KErrNone; |
|
272 |
__UHEAP_MARK; |
|
273 |
removeCalendarFileL(); |
|
274 |
||
275 |
CCalDelTestCases *calDelTest = CCalDelTestCases::NewL(result); |
|
276 |
||
277 |
CleanupStack::PushL( calDelTest ); |
|
278 |
||
279 |
calDelTest->TestDeleteUsingGUidAsyncL(); |
|
280 |
||
281 |
CleanupStack::PopAndDestroy( calDelTest ); |
|
282 |
||
283 |
removeCalendarFileL(); |
|
284 |
__UHEAP_MARKEND; |
|
285 |
return result; |
|
286 |
} |
|
287 |
||
288 |
||
289 |
TInt CTCalendarDeleteTest::DeleteUsingLocalUidAsync(CStifItemParser & /*aItem*/ ) |
|
290 |
{ |
|
291 |
TInt result = KErrNone; |
|
292 |
__UHEAP_MARK; |
|
293 |
removeCalendarFileL(); |
|
294 |
||
295 |
CCalDelTestCases *calDelTest = CCalDelTestCases::NewL(result); |
|
296 |
||
297 |
CleanupStack::PushL( calDelTest ); |
|
298 |
||
299 |
calDelTest->TestDeleteUsingLocalUidAsyncL(); |
|
300 |
||
301 |
CleanupStack::PopAndDestroy( calDelTest ); |
|
302 |
||
303 |
removeCalendarFileL(); |
|
304 |
__UHEAP_MARKEND; |
|
305 |
return result; |
|
306 |
} |
|
307 |
||
308 |
||
309 |
TInt CTCalendarDeleteTest::DeleteTmRgLocalUidAsync(CStifItemParser & /*aItem*/ ) |
|
310 |
{ |
|
311 |
TInt result = KErrNone; |
|
312 |
__UHEAP_MARK; |
|
313 |
removeCalendarFileL(); |
|
314 |
||
315 |
CCalDelTestCases *calDelTest = CCalDelTestCases::NewL(result); |
|
316 |
||
317 |
CleanupStack::PushL( calDelTest ); |
|
318 |
||
319 |
calDelTest->TestDeleteTmRgLocalUidAsyncL(); |
|
320 |
||
321 |
CleanupStack::PopAndDestroy( calDelTest ); |
|
322 |
||
323 |
removeCalendarFileL(); |
|
324 |
__UHEAP_MARKEND; |
|
325 |
return result; |
|
326 |
} |
|
327 |
||
328 |
||
329 |
TInt CTCalendarDeleteTest::DeleteTmRgGUidAsync(CStifItemParser & /*aItem*/ ) |
|
330 |
{ |
|
331 |
TInt result = KErrNone; |
|
332 |
__UHEAP_MARK; |
|
333 |
removeCalendarFileL(); |
|
334 |
||
335 |
CCalDelTestCases *calDelTest = CCalDelTestCases::NewL(result); |
|
336 |
||
337 |
CleanupStack::PushL( calDelTest ); |
|
338 |
||
339 |
calDelTest->TestDeleteTmRgGUidAsyncL(); |
|
340 |
||
341 |
CleanupStack::PopAndDestroy( calDelTest ); |
|
342 |
||
343 |
removeCalendarFileL(); |
|
344 |
__UHEAP_MARKEND; |
|
345 |
return result; |
|
346 |
} |
|
347 |
||
348 |
||
349 |
TInt CTCalendarDeleteTest::DeleteTmRgAsync(CStifItemParser & /*aItem*/ ) |
|
350 |
{ |
|
351 |
TInt result = KErrNone; |
|
352 |
__UHEAP_MARK; |
|
353 |
removeCalendarFileL(); |
|
354 |
||
355 |
CCalDelTestCases *calDelTest = CCalDelTestCases::NewL(result); |
|
356 |
||
357 |
CleanupStack::PushL( calDelTest ); |
|
358 |
||
359 |
calDelTest->TestDeleteTmRgAsyncL(); |
|
360 |
||
361 |
CleanupStack::PopAndDestroy( calDelTest ); |
|
362 |
||
363 |
removeCalendarFileL(); |
|
364 |
__UHEAP_MARKEND; |
|
365 |
return result; |
|
366 |
} |