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 - 2007 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> |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
24 |
#include <StifTestInterface.h> |
19 | 25 |
#include "tcal_export.h" |
26 |
#include "calendarheader.h" |
|
27 |
#include "calendarservice.h" |
|
28 |
#include "exportestcases.h" |
|
29 |
||
30 |
||
31 |
// EXTERNAL DATA STRUCTURES |
|
32 |
//extern ?external_data; |
|
33 |
||
34 |
// EXTERNAL FUNCTION PROTOTYPES |
|
35 |
//extern ?external_function( ?arg_type,?arg_type ); |
|
36 |
||
37 |
// CONSTANTS |
|
38 |
//const ?type ?constant_var = ?constant; |
|
39 |
||
40 |
// MACROS |
|
41 |
//#define ?macro ?macro_def |
|
42 |
||
43 |
// LOCAL CONSTANTS AND MACROS |
|
44 |
//const ?type ?constant_var = ?constant; |
|
45 |
//#define ?macro_name ?macro_def |
|
46 |
||
47 |
// MODULE DATA STRUCTURES |
|
48 |
//enum ?declaration |
|
49 |
//typedef ?declaration |
|
50 |
||
51 |
// LOCAL FUNCTION PROTOTYPES |
|
52 |
//?type ?function_name( ?arg_type, ?arg_type ); |
|
53 |
||
54 |
// FORWARD DECLARATIONS |
|
55 |
//class ?FORWARD_CLASSNAME; |
|
56 |
||
57 |
// ============================= LOCAL FUNCTIONS =============================== |
|
58 |
||
59 |
// ----------------------------------------------------------------------------- |
|
60 |
// ?function_name ?description. |
|
61 |
// ?description |
|
62 |
// Returns: ?value_1: ?description |
|
63 |
// ?value_n: ?description_line1 |
|
64 |
// ?description_line2 |
|
65 |
// ----------------------------------------------------------------------------- |
|
66 |
// |
|
67 |
/* |
|
68 |
?type ?function_name( |
|
69 |
?arg_type arg, // ?description |
|
70 |
?arg_type arg) // ?description |
|
71 |
{ |
|
72 |
||
73 |
?code // ?comment |
|
74 |
||
75 |
// ?comment |
|
76 |
?code |
|
77 |
} |
|
78 |
*/ |
|
79 |
||
80 |
// ============================ MEMBER FUNCTIONS =============================== |
|
81 |
||
82 |
// ----------------------------------------------------------------------------- |
|
83 |
// Ctcal_export::Delete |
|
84 |
// Delete here all resources allocated and opened from test methods. |
|
85 |
// Called from destructor. |
|
86 |
// ----------------------------------------------------------------------------- |
|
87 |
// |
|
88 |
void Ctcal_export::Delete() |
|
89 |
{ |
|
90 |
||
91 |
} |
|
92 |
||
93 |
// ----------------------------------------------------------------------------- |
|
94 |
// Ctcal_export::RunMethodL |
|
95 |
// Run specified method. Contains also table of test mothods and their names. |
|
96 |
// ----------------------------------------------------------------------------- |
|
97 |
// |
|
98 |
TInt Ctcal_export::RunMethodL( |
|
99 |
CStifItemParser& aItem ) |
|
100 |
{ |
|
101 |
||
102 |
static TStifFunctionInfo const KFunctions[] = |
|
103 |
{ |
|
104 |
// Copy this line for every implemented function. |
|
105 |
// First string is the function name used in TestScripter script file. |
|
106 |
// Second is the actual implementation member function. |
|
107 |
ENTRY( "ExportCases", Ctcal_export::ExportCases ), |
|
108 |
ENTRY( "ExportGuid", Ctcal_export::ExportGuid ), |
|
109 |
ENTRY( "ExportGuidBufAsync", Ctcal_export::ExportGuidBufAsync ), |
|
110 |
ENTRY( "ExportGuidFileAsync", Ctcal_export::ExportGuidFileAsync), |
|
111 |
ENTRY( "ExportLuid", Ctcal_export::ExportLuid), |
|
112 |
ENTRY( "ExportLuidAsync", Ctcal_export::ExportLuidAsync), |
|
113 |
ENTRY( "ExportCaseAsync", Ctcal_export::ExportCaseAsync), |
|
114 |
ENTRY( "RemoveFile", Ctcal_export::RemoveFile ), |
|
115 |
//ADD NEW ENTRY HERE |
|
116 |
||
117 |
}; |
|
118 |
||
119 |
const TInt count = sizeof( KFunctions ) / |
|
120 |
sizeof( TStifFunctionInfo ); |
|
121 |
||
122 |
return RunInternalL( KFunctions, count, aItem ); |
|
123 |
||
124 |
} |
|
125 |
||
126 |
// Function to remove a file |
|
127 |
TInt Ctcal_export::RemoveFile( CStifItemParser& aItem ) |
|
128 |
{ |
|
129 |
TPtrC16 file; |
|
130 |
aItem.GetNextString(file); |
|
131 |
RFile LogResult; |
|
132 |
RFs LogResultSession; |
|
133 |
User::LeaveIfError(LogResultSession.Connect()); |
|
134 |
if(LogResult.Open(LogResultSession ,file , EFileWrite | EFileShareAny ) != KErrNotFound) |
|
135 |
{ |
|
136 |
LogResult.Close(); |
|
137 |
||
138 |
LogResultSession.Delete(file); |
|
139 |
||
140 |
LogResultSession.Close(); |
|
141 |
} |
|
142 |
||
143 |
LogResult.Close(); |
|
144 |
LogResultSession.Close(); |
|
145 |
return KErrNone; |
|
146 |
||
147 |
} |
|
148 |
||
149 |
||
150 |
// ----------------------------------------------------------------------------- |
|
151 |
// Ctcal_export::ExportCases |
|
152 |
// Example test method function to test few cases with export - sync |
|
153 |
// (other items were commented in a header). |
|
154 |
// ----------------------------------------------------------------------------- |
|
155 |
// |
|
156 |
TInt Ctcal_export::ExportCases( CStifItemParser& aItem ) |
|
157 |
{ |
|
158 |
||
159 |
__UHEAP_MARK; |
|
160 |
||
161 |
TInt result=KErrNone; |
|
162 |
||
163 |
CCalExpTestCases *calExpTest = CCalExpTestCases::NewL(result); |
|
164 |
||
165 |
CleanupStack::PushL(calExpTest); |
|
166 |
||
167 |
result = calExpTest->TestExportCasesL(); |
|
168 |
||
169 |
CleanupStack::PopAndDestroy(calExpTest); |
|
170 |
||
171 |
__UHEAP_MARKEND; |
|
172 |
||
173 |
return result; |
|
174 |
} |
|
175 |
||
176 |
||
177 |
// ----------------------------------------------------------------------------- |
|
178 |
// Ctcal_export::ExportGuid |
|
179 |
// Example test method function to export Guid - sync |
|
180 |
// (other items were commented in a header). |
|
181 |
// ----------------------------------------------------------------------------- |
|
182 |
// |
|
183 |
TInt Ctcal_export::ExportGuid( CStifItemParser& aItem ) |
|
184 |
{ |
|
185 |
||
186 |
__UHEAP_MARK; |
|
187 |
||
188 |
TInt result=KErrNone; |
|
189 |
||
190 |
CCalExpTestCases *calExpTest = CCalExpTestCases::NewL(result); |
|
191 |
||
192 |
CleanupStack::PushL(calExpTest); |
|
193 |
||
194 |
result = calExpTest->TestExportForGuidsL(); |
|
195 |
||
196 |
CleanupStack::PopAndDestroy(calExpTest); |
|
197 |
||
198 |
__UHEAP_MARKEND; |
|
199 |
||
200 |
return result; |
|
201 |
} |
|
202 |
||
203 |
||
204 |
// ----------------------------------------------------------------------------- |
|
205 |
// Ctcal_export::ExportGuidBufAsync |
|
206 |
// Example test method function to export Guid - async using buf |
|
207 |
// (other items were commented in a header). |
|
208 |
// ----------------------------------------------------------------------------- |
|
209 |
// |
|
210 |
TInt Ctcal_export::ExportGuidBufAsync( CStifItemParser& aItem ) |
|
211 |
{ |
|
212 |
||
213 |
__UHEAP_MARK; |
|
214 |
||
215 |
TInt result=KErrNone; |
|
216 |
||
217 |
CCalExpTestCases *calExpTest = CCalExpTestCases::NewL(result); |
|
218 |
||
219 |
CleanupStack::PushL(calExpTest); |
|
220 |
||
221 |
calExpTest->TestExportForGuidsBufAsyncL(); |
|
222 |
||
223 |
CleanupStack::PopAndDestroy(calExpTest); |
|
224 |
||
225 |
__UHEAP_MARKEND; |
|
226 |
||
227 |
return result; |
|
228 |
} |
|
229 |
||
230 |
// ----------------------------------------------------------------------------- |
|
231 |
// Ctcal_export::ExportGuidFileAsync |
|
232 |
// Example test method function to export Guid - async using file |
|
233 |
// (other items were commented in a header). |
|
234 |
// ----------------------------------------------------------------------------- |
|
235 |
// |
|
236 |
TInt Ctcal_export::ExportGuidFileAsync( CStifItemParser& aItem ) |
|
237 |
{ |
|
238 |
||
239 |
__UHEAP_MARK; |
|
240 |
||
241 |
TInt result=KErrNone; |
|
242 |
||
243 |
CCalExpTestCases *calExpTest = CCalExpTestCases::NewL(result); |
|
244 |
||
245 |
CleanupStack::PushL(calExpTest); |
|
246 |
||
247 |
calExpTest->TestExportForGuidsFileAsyncL(); |
|
248 |
||
249 |
CleanupStack::PopAndDestroy(calExpTest); |
|
250 |
||
251 |
__UHEAP_MARKEND; |
|
252 |
||
253 |
return result; |
|
254 |
} |
|
255 |
||
256 |
||
257 |
// ----------------------------------------------------------------------------- |
|
258 |
// Ctcal_export::ExportLuid |
|
259 |
// Example test method function to export Luid for vcal - sync |
|
260 |
// (other items were commented in a header). |
|
261 |
// ----------------------------------------------------------------------------- |
|
262 |
// |
|
263 |
TInt Ctcal_export::ExportLuid( CStifItemParser& aItem ) |
|
264 |
{ |
|
265 |
||
266 |
__UHEAP_MARK; |
|
267 |
||
268 |
TInt result=KErrNone; |
|
269 |
||
270 |
CCalExpTestCases *calExpTest = CCalExpTestCases::NewL(result); |
|
271 |
||
272 |
CleanupStack::PushL(calExpTest); |
|
273 |
||
274 |
result = calExpTest->TestExportForLuidsL(); |
|
275 |
||
276 |
CleanupStack::PopAndDestroy(calExpTest); |
|
277 |
||
278 |
__UHEAP_MARKEND; |
|
279 |
||
280 |
return result; |
|
281 |
} |
|
282 |
||
283 |
||
284 |
// ----------------------------------------------------------------------------- |
|
285 |
// Ctcal_export::ExportLuidAsync |
|
286 |
// Example test method function to export Luid for vcal- async using buf |
|
287 |
// (other items were commented in a header). |
|
288 |
// ----------------------------------------------------------------------------- |
|
289 |
// |
|
290 |
TInt Ctcal_export::ExportLuidAsync( CStifItemParser& aItem ) |
|
291 |
{ |
|
292 |
||
293 |
__UHEAP_MARK; |
|
294 |
||
295 |
TInt result=KErrNone; |
|
296 |
||
297 |
CCalExpTestCases *calExpTest = CCalExpTestCases::NewL(result); |
|
298 |
||
299 |
CleanupStack::PushL(calExpTest); |
|
300 |
||
301 |
calExpTest->TestExportForLuidAsyncL(); |
|
302 |
||
303 |
CleanupStack::PopAndDestroy(calExpTest); |
|
304 |
||
305 |
__UHEAP_MARKEND; |
|
306 |
||
307 |
return result; |
|
308 |
} |
|
309 |
||
310 |
// ----------------------------------------------------------------------------- |
|
311 |
// Ctcal_export::ExportCaseAsync |
|
312 |
// Example test method function to test case with export - async |
|
313 |
// (other items were commented in a header). |
|
314 |
// ----------------------------------------------------------------------------- |
|
315 |
// |
|
316 |
TInt Ctcal_export::ExportCaseAsync( CStifItemParser& aItem ) |
|
317 |
{ |
|
318 |
||
319 |
__UHEAP_MARK; |
|
320 |
||
321 |
TInt result=KErrNone; |
|
322 |
||
323 |
CCalExpTestCases *calExpTest = CCalExpTestCases::NewL(result); |
|
324 |
||
325 |
CleanupStack::PushL(calExpTest); |
|
326 |
||
327 |
calExpTest->TestExportCaseAsyncL(); |
|
328 |
||
329 |
CleanupStack::PopAndDestroy(calExpTest); |
|
330 |
||
331 |
__UHEAP_MARKEND; |
|
332 |
||
333 |
return result; |
|
334 |
} |
|
335 |
||
336 |
// ----------------------------------------------------------------------------- |
|
337 |
// Ctcal_export::?member_function |
|
338 |
// ?implementation_description |
|
339 |
// (other items were commented in a header). |
|
340 |
// ----------------------------------------------------------------------------- |
|
341 |
// |
|
342 |
/* |
|
343 |
TInt Ctcal_export::?member_function( |
|
344 |
CItemParser& aItem ) |
|
345 |
{ |
|
346 |
||
347 |
?code |
|
348 |
||
349 |
} |
|
350 |
*/ |
|
351 |
||
352 |
// ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
353 |
// None |
|
354 |
||
355 |
// End of File |