|
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 "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: SendUIAPITestBlocks implementation* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 // [INCLUDE FILES] - do not remove |
|
21 #include <e32svr.h> |
|
22 #include <StifParser.h> |
|
23 #include <Stiftestinterface.h> |
|
24 #include "SendUIAPITest.h" |
|
25 #include <SendUi.h> |
|
26 #include <EIKENV.H> |
|
27 #include <cmessagedata.h> |
|
28 #include <CMessageAddress.h> |
|
29 #include <TSendingCapabilities.h> |
|
30 #include <TXTRICH.H> |
|
31 #include <EIKDEF.H> |
|
32 #include <eikmobs.h> |
|
33 #include <f32file.h> |
|
34 #include <S32MEM.H> |
|
35 #include <CSendingServiceInfo.h> |
|
36 #include <SendUiConsts.h> |
|
37 #include <EIKMOBS.H> |
|
38 |
|
39 |
|
40 // EXTERNAL DATA STRUCTURES |
|
41 //extern ?external_data; |
|
42 |
|
43 // EXTERNAL FUNCTION PROTOTYPES |
|
44 //extern ?external_function( ?arg_type,?arg_type ); |
|
45 |
|
46 // CONSTANTS |
|
47 //const ?type ?constant_var = ?constant; |
|
48 _LIT( KTestText, "TestText1234567910"); |
|
49 const TInt KMessageBufferSize = 4 * sizeof(TUint32); |
|
50 const TInt KFilePathSize = 256; |
|
51 const TUid KServideId = {0x10005522}; |
|
52 |
|
53 |
|
54 // MACROS |
|
55 //#define ?macro ?macro_def |
|
56 |
|
57 // LOCAL CONSTANTS AND MACROS |
|
58 //const ?type ?constant_var = ?constant; |
|
59 //#define ?macro_name ?macro_def |
|
60 _LIT (KTextSupportsEditor, "With Editor:"); |
|
61 _LIT (KTextOpenEditor, "Open editor:"); |
|
62 _LIT (KWrite, "Write:"); |
|
63 _LIT (KTextDoNothing, "Show all"); |
|
64 |
|
65 // MODULE DATA STRUCTURES |
|
66 //enum ?declaration |
|
67 //typedef ?declaration |
|
68 |
|
69 // LOCAL FUNCTION PROTOTYPES |
|
70 //?type ?function_name( ?arg_type, ?arg_type ); |
|
71 |
|
72 // FORWARD DECLARATIONS |
|
73 //class ?FORWARD_CLASSNAME; |
|
74 |
|
75 // ============================= LOCAL FUNCTIONS =============================== |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // ?function_name ?description. |
|
79 // ?description |
|
80 // Returns: ?value_1: ?description |
|
81 // ?value_n: ?description_line1 |
|
82 // ?description_line2 |
|
83 // ----------------------------------------------------------------------------- |
|
84 // |
|
85 CMessageData* CSendUIAPITest::InitL( |
|
86 ) |
|
87 { |
|
88 if(!iMessageData) |
|
89 { |
|
90 iMessageData = CMessageData::NewL(); |
|
91 } |
|
92 return iMessageData; |
|
93 } |
|
94 |
|
95 // ============================ MEMBER FUNCTIONS =============================== |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // CSendUIAPITest::Delete |
|
99 // Delete here all resources allocated and opened from test methods. |
|
100 // Called from destructor. |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 void CSendUIAPITest::Delete() |
|
104 { |
|
105 // Print to UI |
|
106 _LIT( KSendUIAPITest, "SendUIAPITest" ); |
|
107 _LIT( KDelete, "In Delete" ); |
|
108 TestModuleIf().Printf( 0, KSendUIAPITest, KDelete ); |
|
109 // Print to log file |
|
110 iLog->Log( KDelete ); |
|
111 |
|
112 if(iMessageData) |
|
113 { |
|
114 // Delete Message Data Object |
|
115 _LIT( KDeleteObj, "Delete CMessageData Object" ); |
|
116 iLog->Log( KDeleteObj ); |
|
117 delete iMessageData; |
|
118 iMessageData = NULL; |
|
119 } |
|
120 if(iMessageAddress) |
|
121 { |
|
122 // Print to log file |
|
123 _LIT( KDeleteMsgAdrObj, "Delete CMessageAddress Object" ); |
|
124 iLog->Log( KDeleteMsgAdrObj ); |
|
125 delete iMessageAddress; |
|
126 iMessageAddress = NULL; |
|
127 } |
|
128 } |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // CSendUIAPITest::RunMethodL |
|
132 // Run specified method. Contains also table of test mothods and their names. |
|
133 // ----------------------------------------------------------------------------- |
|
134 // |
|
135 TInt CSendUIAPITest::RunMethodL( |
|
136 CStifItemParser& aItem ) |
|
137 { |
|
138 |
|
139 static TStifFunctionInfo const KFunctions[] = |
|
140 { |
|
141 // Copy this line for every implemented function. |
|
142 // First string is the function name used in TestScripter script file. |
|
143 // Second is the actual implementation member function. |
|
144 //ENTRY( "Example", CSendUIAPITest::ExampleL ), |
|
145 //CMessageData |
|
146 ENTRY( "MessageDataNewL", CSendUIAPITest::TestMessageDataNewL ), |
|
147 ENTRY( "MessageDataSetSubjectL", CSendUIAPITest::TestMessageDataSetSubjectL ), |
|
148 ENTRY( "MessageDataSubject", CSendUIAPITest::TestMessageDataSubjectL ), |
|
149 ENTRY( "MessageDataAppendAttachmentL", CSendUIAPITest::TestMessageDataAppendAttachmentL ), |
|
150 ENTRY( "MessageDataAttachmentArray", CSendUIAPITest::TestMessageDataAttachmentArrayL ), |
|
151 ENTRY( "MessageDataClearAttachmentArray", CSendUIAPITest::TestMessageDataClearAttachmentArrayL ), |
|
152 ENTRY( "MessageDataAppendToAddressL", CSendUIAPITest::TestMessageDataAppendToAddressL ), |
|
153 ENTRY( "MessageDataToAddressArray", CSendUIAPITest::TestMessageDataToAddressArrayL ), |
|
154 ENTRY( "MessageDataAppendCcAddressL", CSendUIAPITest::TestMessageDataAppendCcAddressL ), |
|
155 ENTRY( "MessageDataCcAddressArray", CSendUIAPITest::TestMessageDataCcAddressArrayL ), |
|
156 ENTRY( "MessageDataAppendBccAddressL", CSendUIAPITest::TestMessageDataAppendBccAddressL ), |
|
157 ENTRY( "MessageDataBccAddressArray", CSendUIAPITest::TestMessageDataBccAddressArrayL ), |
|
158 ENTRY( "MessageDataSetBodyTextL", CSendUIAPITest::TestMessageDataSetBodyTextL ), |
|
159 ENTRY( "MessageDataBodyText", CSendUIAPITest::TestMessageDataBodyTextL ), |
|
160 ENTRY( "MessageDataAppendAttachmentHandleL", CSendUIAPITest::TestAppendAttachmentHandleL ), |
|
161 ENTRY( "MessageDataAttachmentHandleArray", CSendUIAPITest::TestAttachmentHandleArrayL ), |
|
162 ENTRY( "MessageDataDataType", CSendUIAPITest::TestDataTypeL ), |
|
163 ENTRY( "MessageDataClearAddresses", CSendUIAPITest::ClearAddressesL ), |
|
164 ENTRY( "MessageDataExternalizeLnInternalizeL", CSendUIAPITest::TestExternalizeLnInternalizeL ), |
|
165 ENTRY( "MessageDataSetOpaqueDataL", CSendUIAPITest::TestSetOpaqueDataL ), |
|
166 ENTRY( "MessageDataOpaqueDataL", CSendUIAPITest::TestOpaqueDataL ), |
|
167 //CMessageAddress |
|
168 ENTRY( "MessageAddressNewL", CSendUIAPITest::TestCMessageAddressNewL ), |
|
169 ENTRY( "MessageAddressSetAddressL", CSendUIAPITest::TestMsgAdrsSetAddressL ), |
|
170 ENTRY( "MessageAddressAddress", CSendUIAPITest::TestMsgAdrsAddress ), |
|
171 ENTRY( "MessageAddressSetAliasL", CSendUIAPITest::TestMsgAdrsSetAliasL ), |
|
172 ENTRY( "MessageAddressAlias", CSendUIAPITest::TestMsgAdrsAlias ), |
|
173 ENTRY( "MessageAddressExternalizeL", CSendUIAPITest::TestMsgAdrsExternalizeL ), |
|
174 ENTRY( "MessageAddressInternalizeL", CSendUIAPITest::TestMsgAdrsInternalizeL ), |
|
175 //TSendingCapabilities |
|
176 ENTRY( "TSendingCapabilities", CSendUIAPITest::TestTSendingCapabilities ), |
|
177 //CSendingServiceInfo |
|
178 ENTRY( "SendingServiceInfoCopyLC", CSendUIAPITest::TestCopyLC ), |
|
179 ENTRY( "SendingServiceInfoSetTechnologyTypeId", CSendUIAPITest::TestSetTechnologyTypeIdL ), |
|
180 ENTRY( "SendingServiceInfoServiceID", CSendUIAPITest::TestServiceIDL ), |
|
181 ENTRY( "SendingServiceInfoServiceProviderID", CSendUIAPITest::TestServiceProviderIDL ), |
|
182 ENTRY( "SendingServiceInfoServiceCapabilities", CSendUIAPITest::TestServiceCapabilitiesL ), |
|
183 //CSendUI |
|
184 ENTRY( "SendUIAddSendMenuItemLL", CSendUIAPITest::TestCSendUIAddSendMenuItemLL ), |
|
185 ENTRY( "SendUINewLCL", CSendUIAPITest::TestCSendUINewLCL ), |
|
186 ENTRY( "SendUIShowQueryAndSendLL", CSendUIAPITest::TestCSendUIShowQueryAndSendLL ), |
|
187 ENTRY( "SendUIShowSendQueryLL", CSendUIAPITest::TestCSendUIShowSendQueryLL ), |
|
188 ENTRY( "SendUIValidateServiceLL", CSendUIAPITest::TestCSendUIValidateServiceLL ), |
|
189 ENTRY( "SendUIServiceCapabilitiesLL", CSendUIAPITest::TestCSendUIServiceCapabilitiesLL ), |
|
190 ENTRY( "SendUIAvailableServicesLL", CSendUIAPITest::TestCSendUIAvailableServicesLL ), |
|
191 ENTRY( "SendUIAddTypedMenuItemLL", CSendUIAPITest::TestCSendUIAddTypedMenuItemLL ), |
|
192 ENTRY( "SendUIShowTypedQueryAndSendLL", CSendUIAPITest::TestCSendUIShowTypedQueryAndSendLL ), |
|
193 ENTRY( "SendUIShowTypedQueryLL", CSendUIAPITest::TestCSendUIShowTypedQueryLL ), |
|
194 //ADD NEW ENTRY HERE |
|
195 // [test cases entries] - Do not remove |
|
196 |
|
197 }; |
|
198 |
|
199 const TInt count = sizeof( KFunctions ) / |
|
200 sizeof( TStifFunctionInfo ); |
|
201 |
|
202 return RunInternalL( KFunctions, count, aItem ); |
|
203 |
|
204 } |
|
205 |
|
206 // ----------------------------------------------------------------------------- |
|
207 // CSendUIAPITest::ExampleL |
|
208 // Example test method function. |
|
209 // (other items were commented in a header). |
|
210 // ----------------------------------------------------------------------------- |
|
211 // |
|
212 TInt CSendUIAPITest::ExampleL( CStifItemParser& aItem ) |
|
213 { |
|
214 |
|
215 // Print to UI |
|
216 _LIT( KSendUIAPITest, "SendUIAPITest" ); |
|
217 _LIT( KExample, "In Example" ); |
|
218 TestModuleIf().Printf( 0, KSendUIAPITest, KExample ); |
|
219 // Print to log file |
|
220 iLog->Log( KExample ); |
|
221 |
|
222 TInt i = 0; |
|
223 TPtrC string; |
|
224 _LIT( KParam, "Param[%i]: %S" ); |
|
225 while ( aItem.GetNextString ( string ) == KErrNone ) |
|
226 { |
|
227 TestModuleIf().Printf( i, KSendUIAPITest, |
|
228 KParam, i, &string ); |
|
229 i++; |
|
230 } |
|
231 return KErrNone; |
|
232 |
|
233 } |
|
234 |
|
235 // ----------------------------------------------------------------------------- |
|
236 // CSendUIAPITest::?TestMessageDataNewL |
|
237 // ?Test Case for Calling CMessageData's NewL fun |
|
238 // (other items were commented in a header). |
|
239 // ----------------------------------------------------------------------------- |
|
240 // |
|
241 |
|
242 TInt CSendUIAPITest::TestMessageDataNewL( CStifItemParser& /*aItem*/ ) |
|
243 { |
|
244 // Print to UI |
|
245 _LIT( KSendUIAPITest, "SendUIAPITest" ); |
|
246 _LIT( KNewL, "In NewL" ); |
|
247 TestModuleIf().Printf( 0, KSendUIAPITest, KNewL ); |
|
248 // Print to log file |
|
249 iLog->Log( KNewL); |
|
250 |
|
251 //Create the object of CSendUIAPITest |
|
252 CMessageData* messagedata = InitL(); |
|
253 //Check the instance of CMessageData |
|
254 if(messagedata) |
|
255 { |
|
256 return KErrNone; |
|
257 } |
|
258 else |
|
259 { |
|
260 return KErrGeneral; |
|
261 } |
|
262 } |
|
263 |
|
264 // ----------------------------------------------------------------------------- |
|
265 // CSendUIAPITest::?TestMessageDataSetSubjectL |
|
266 // ?Test Case for Calling CMessageData's SetSubjectL fun |
|
267 // (other items were commented in a header). |
|
268 // ----------------------------------------------------------------------------- |
|
269 // |
|
270 |
|
271 TInt CSendUIAPITest::TestMessageDataSetSubjectL( CStifItemParser& aItem ) |
|
272 { |
|
273 // Print to UI |
|
274 _LIT( KSendUIAPITest, "SendUIAPITest" ); |
|
275 _LIT( KSetSubjectL, "In SetSubjectL" ); |
|
276 TestModuleIf().Printf( 0, KSendUIAPITest, KSetSubjectL ); |
|
277 // Print to log file |
|
278 iLog->Log( KSetSubjectL); |
|
279 |
|
280 //Create the instance of CMessageData |
|
281 CMessageData* messagedata = InitL(); |
|
282 |
|
283 TPtrC subject; |
|
284 //Get the subject from cfg file |
|
285 aItem.GetNextString(subject); |
|
286 //Set the subject |
|
287 TRAPD(err,messagedata->SetSubjectL(&subject)); |
|
288 if(err == KErrNone) |
|
289 { |
|
290 return KErrNone; |
|
291 } |
|
292 else |
|
293 { |
|
294 return err; |
|
295 } |
|
296 } |
|
297 |
|
298 // ----------------------------------------------------------------------------- |
|
299 // CSendUIAPITest::?TestMessageDataSubjectL |
|
300 // ?Test Case for Calling CMessageData's Subject fun |
|
301 // (other items were commented in a header). |
|
302 // ----------------------------------------------------------------------------- |
|
303 // |
|
304 |
|
305 TInt CSendUIAPITest::TestMessageDataSubjectL( CStifItemParser& aItem ) |
|
306 { |
|
307 // Print to UI |
|
308 _LIT( KSendUIAPITest, "SendUIAPITest" ); |
|
309 _LIT( KSubject, "In Subject" ); |
|
310 TestModuleIf().Printf( 0, KSendUIAPITest, KSubject ); |
|
311 // Print to log file |
|
312 iLog->Log( KSubject); |
|
313 |
|
314 //Create the instance of CMessageData |
|
315 CMessageData* messagedata = InitL(); |
|
316 //Get the subject from message data |
|
317 TPtrC msgdatasubject = messagedata->Subject(); |
|
318 |
|
319 TPtrC msgsubject; |
|
320 //Get the subject from cfg file |
|
321 aItem.GetNextString(msgsubject); |
|
322 //Compare the two subjects |
|
323 if(msgdatasubject == msgsubject) |
|
324 { |
|
325 return KErrNone; |
|
326 } |
|
327 else |
|
328 { |
|
329 return KErrGeneral; |
|
330 } |
|
331 } |
|
332 |
|
333 // ----------------------------------------------------------------------------- |
|
334 // CSendUIAPITest::?TestMessageDataAppendAttachmentL |
|
335 // ?Test Case for Calling CMessageData's AppendAttachmentL fun |
|
336 // (other items were commented in a header). |
|
337 // ----------------------------------------------------------------------------- |
|
338 // |
|
339 |
|
340 TInt CSendUIAPITest::TestMessageDataAppendAttachmentL( CStifItemParser& aItem ) |
|
341 { |
|
342 // Print to UI |
|
343 _LIT( KSendUIAPITest, "SendUIAPITest" ); |
|
344 _LIT( KAppendAttachmentL, "In AppendAttachmentL" ); |
|
345 TestModuleIf().Printf( 0, KSendUIAPITest, KAppendAttachmentL ); |
|
346 // Print to log file |
|
347 iLog->Log( KAppendAttachmentL); |
|
348 |
|
349 //Create the instance of CMessageData |
|
350 CMessageData* messagedata = InitL(); |
|
351 |
|
352 TPtrC filepath; |
|
353 //Get the file path from cfg file |
|
354 aItem.GetNextString(filepath); |
|
355 TDesC filepathdesc(filepath); |
|
356 |
|
357 //Append the file path in message data |
|
358 TRAPD(err,messagedata->AppendAttachmentL(filepath)); |
|
359 if(err == KErrNone) |
|
360 { |
|
361 return KErrNone; |
|
362 } |
|
363 |
|
364 else |
|
365 { |
|
366 return err; |
|
367 } |
|
368 |
|
369 } |
|
370 |
|
371 // ----------------------------------------------------------------------------- |
|
372 // CSendUIAPITest::?TestMessageDataAttachmentArrayL |
|
373 // ?Test Case for Calling CMessageData's AttachmentArray fun |
|
374 // (other items were commented in a header). |
|
375 // ----------------------------------------------------------------------------- |
|
376 // |
|
377 |
|
378 TInt CSendUIAPITest::TestMessageDataAttachmentArrayL( CStifItemParser& /*aItem*/ ) |
|
379 { |
|
380 // Print to UI |
|
381 _LIT( KSendUIAPITest, "SendUIAPITest" ); |
|
382 _LIT( KAttachmentArray, "In AttachmentArray" ); |
|
383 TestModuleIf().Printf( 0, KSendUIAPITest, KAttachmentArray ); |
|
384 // Print to log file |
|
385 iLog->Log( KAttachmentArray); |
|
386 |
|
387 //Create the instance of CMessageData |
|
388 CMessageData* messagedata = InitL(); |
|
389 |
|
390 //Get the Array of attachment file paths and check the count |
|
391 TInt count = messagedata->AttachmentArray().Count(); |
|
392 if(count > 0) |
|
393 { |
|
394 return KErrNone; |
|
395 } |
|
396 else |
|
397 { |
|
398 return KErrGeneral; |
|
399 } |
|
400 } |
|
401 |
|
402 // ----------------------------------------------------------------------------- |
|
403 // CSendUIAPITest::?TestMessageDataClearAttachmentArrayL |
|
404 // ?Test Case for Calling CMessageData's ClearAttachmentArray fun |
|
405 // (other items were commented in a header). |
|
406 // ----------------------------------------------------------------------------- |
|
407 // |
|
408 |
|
409 TInt CSendUIAPITest::TestMessageDataClearAttachmentArrayL( CStifItemParser& aItem ) |
|
410 { |
|
411 // Print to UI |
|
412 _LIT( KSendUIAPITest, "SendUIAPITest" ); |
|
413 _LIT( KClearAttachmentArray, "In ClearAttachmentArray" ); |
|
414 TestModuleIf().Printf( 0, KSendUIAPITest, KClearAttachmentArray ); |
|
415 // Print to log file |
|
416 iLog->Log( KClearAttachmentArray); |
|
417 |
|
418 //Create the instance of CMessageData |
|
419 CMessageData* messagedata = InitL(); |
|
420 |
|
421 //Clears the array of attachment file paths |
|
422 messagedata->ClearAttachmentArray(); |
|
423 |
|
424 TInt attacharraycount; |
|
425 //Get the attachment arry count from cfg file |
|
426 aItem.GetNextInt(attacharraycount); |
|
427 //Compare the two counts |
|
428 if(attacharraycount == messagedata->AttachmentArray().Count()) |
|
429 { |
|
430 return KErrNone; |
|
431 } |
|
432 else |
|
433 { |
|
434 return KErrGeneral; |
|
435 } |
|
436 } |
|
437 |
|
438 // ----------------------------------------------------------------------------- |
|
439 // CSendUIAPITest::?TestMessageDataAppendToAddressL |
|
440 // ?Test Case for Calling CMessageData's AppendToAddressL fun |
|
441 // (other items were commented in a header). |
|
442 // ----------------------------------------------------------------------------- |
|
443 // |
|
444 |
|
445 TInt CSendUIAPITest::TestMessageDataAppendToAddressL( CStifItemParser& aItem ) |
|
446 { |
|
447 // Print to UI |
|
448 _LIT( KSendUIAPITest, "SendUIAPITest" ); |
|
449 _LIT( KAppendToAddressL, "In AppendToAddressL" ); |
|
450 TestModuleIf().Printf( 0, KSendUIAPITest, KAppendToAddressL ); |
|
451 // Print to log file |
|
452 iLog->Log( KAppendToAddressL); |
|
453 |
|
454 //Create the instance of CMessageData |
|
455 CMessageData* messagedata = InitL(); |
|
456 |
|
457 //Get the address from cfg file to append |
|
458 TPtrC addressone; |
|
459 aItem.GetNextString(addressone); |
|
460 |
|
461 TPtrC aliasone; |
|
462 aItem.GetNextString(aliasone); |
|
463 |
|
464 //Append the address to array |
|
465 TRAPD(err, messagedata->AppendToAddressL( addressone, aliasone )); |
|
466 if(err == KErrNone) |
|
467 { |
|
468 return KErrNone; |
|
469 } |
|
470 else |
|
471 { |
|
472 return err; |
|
473 } |
|
474 } |
|
475 |
|
476 // ----------------------------------------------------------------------------- |
|
477 // CSendUIAPITest::?TestMessageDataToAddressArrayL |
|
478 // ?Test Case for Calling CMessageData's ToAddressArray fun |
|
479 // (other items were commented in a header). |
|
480 // ----------------------------------------------------------------------------- |
|
481 // |
|
482 |
|
483 TInt CSendUIAPITest::TestMessageDataToAddressArrayL( CStifItemParser& aItem ) |
|
484 { |
|
485 // Print to UI |
|
486 _LIT( KSendUIAPITest, "SendUIAPITest" ); |
|
487 _LIT( KToAddressArray, "In ToAddressArray" ); |
|
488 TestModuleIf().Printf( 0, KSendUIAPITest, KToAddressArray ); |
|
489 // Print to log file |
|
490 iLog->Log( KToAddressArray); |
|
491 |
|
492 //Create the instance of CMessageData |
|
493 CMessageData* messagedata = InitL(); |
|
494 |
|
495 TInt addresscount; |
|
496 aItem.GetNextInt(addresscount); |
|
497 |
|
498 //Get array of addresses and aliases and compare the count |
|
499 if(addresscount == messagedata->ToAddressArray().Count() ) |
|
500 { |
|
501 return KErrNone; |
|
502 } |
|
503 else |
|
504 { |
|
505 return KErrGeneral; |
|
506 } |
|
507 } |
|
508 |
|
509 // ----------------------------------------------------------------------------- |
|
510 // CSendUIAPITest::?TestMessageDataAppendCcAddressL |
|
511 // ?Test Case for Calling CMessageData's AppendCcAddressL fun |
|
512 // (other items were commented in a header). |
|
513 // ----------------------------------------------------------------------------- |
|
514 // |
|
515 |
|
516 TInt CSendUIAPITest::TestMessageDataAppendCcAddressL( CStifItemParser& aItem ) |
|
517 { |
|
518 // Print to UI |
|
519 _LIT( KSendUIAPITest, "SendUIAPITest" ); |
|
520 _LIT( KAppendCcAddressL, "In AppendCcAddressL" ); |
|
521 TestModuleIf().Printf( 0, KSendUIAPITest, KAppendCcAddressL ); |
|
522 // Print to log file |
|
523 iLog->Log( KAppendCcAddressL); |
|
524 |
|
525 //Create the instance of CMessageData |
|
526 CMessageData* messagedata = InitL(); |
|
527 //Get the two ccaddresses from cfg file |
|
528 TPtrC ccaddressone; |
|
529 aItem.GetNextString(ccaddressone); |
|
530 |
|
531 TPtrC ccaliasone; |
|
532 aItem.GetNextString(ccaliasone); |
|
533 |
|
534 //Append the CC addresses in message data |
|
535 TRAPD(err , messagedata->AppendCcAddressL( ccaddressone, ccaliasone )); |
|
536 if(err == KErrNone) |
|
537 { |
|
538 return KErrNone; |
|
539 } |
|
540 else |
|
541 { |
|
542 return err; |
|
543 } |
|
544 } |
|
545 |
|
546 // ----------------------------------------------------------------------------- |
|
547 // CSendUIAPITest::?TestMessageDataCcAddressArrayL |
|
548 // ?Test Case for Calling CMessageData's CcAddressArray fun |
|
549 // (other items were commented in a header). |
|
550 // ----------------------------------------------------------------------------- |
|
551 // |
|
552 |
|
553 TInt CSendUIAPITest::TestMessageDataCcAddressArrayL( CStifItemParser& aItem ) |
|
554 { |
|
555 // Print to UI |
|
556 _LIT( KSendUIAPITest, "SendUIAPITest" ); |
|
557 _LIT( KCcAddressArray, "In CcAddressArray" ); |
|
558 TestModuleIf().Printf( 0, KSendUIAPITest, KCcAddressArray ); |
|
559 // Print to log file |
|
560 iLog->Log( KCcAddressArray); |
|
561 |
|
562 //Create the instance of CMessageData |
|
563 CMessageData* messagedata = InitL(); |
|
564 |
|
565 //Get the count of cc address from cfg file |
|
566 TInt ccaddresscount; |
|
567 aItem.GetNextInt(ccaddresscount); |
|
568 |
|
569 //Get the CC address count from message data and compare |
|
570 if(ccaddresscount == messagedata->CcAddressArray().Count()) |
|
571 { |
|
572 return KErrNone; |
|
573 } |
|
574 |
|
575 else |
|
576 { |
|
577 return KErrGeneral; |
|
578 } |
|
579 } |
|
580 |
|
581 // ----------------------------------------------------------------------------- |
|
582 // CSendUIAPITest::?TestMessageDataAppendBccAddressL |
|
583 // ?Test Case for Calling CMessageData's AppendBccAddressL fun |
|
584 // (other items were commented in a header). |
|
585 // ----------------------------------------------------------------------------- |
|
586 // |
|
587 |
|
588 TInt CSendUIAPITest::TestMessageDataAppendBccAddressL( CStifItemParser& aItem ) |
|
589 { |
|
590 // Print to UI |
|
591 _LIT( KSendUIAPITest, "SendUIAPITest" ); |
|
592 _LIT( KAppendBccAddressL, "In AppendBccAddressL" ); |
|
593 TestModuleIf().Printf( 0, KSendUIAPITest, KAppendBccAddressL ); |
|
594 // Print to log file |
|
595 iLog->Log( KAppendBccAddressL); |
|
596 |
|
597 //Create the instance of CMessageData |
|
598 CMessageData* messagedata = InitL(); |
|
599 |
|
600 //Get the two bccaddresses from cfg file |
|
601 TPtrC bccaddressone; |
|
602 aItem.GetNextString(bccaddressone); |
|
603 |
|
604 TPtrC bccaliasone; |
|
605 aItem.GetNextString(bccaliasone); |
|
606 |
|
607 //Append the BCC addresses to message data |
|
608 TRAPD(err , messagedata->AppendBccAddressL( bccaddressone, bccaliasone )); |
|
609 if(err == KErrNone) |
|
610 { |
|
611 return KErrNone; |
|
612 } |
|
613 else |
|
614 { |
|
615 return err; |
|
616 } |
|
617 } |
|
618 |
|
619 // ----------------------------------------------------------------------------- |
|
620 // CSendUIAPITest::?TestMessageDataBccAddressArrayL |
|
621 // ?Test Case for Calling CMessageData's BccAddressArray fun |
|
622 // (other items were commented in a header). |
|
623 // ----------------------------------------------------------------------------- |
|
624 // |
|
625 |
|
626 TInt CSendUIAPITest::TestMessageDataBccAddressArrayL( CStifItemParser& aItem ) |
|
627 { |
|
628 // Print to UI |
|
629 _LIT( KSendUIAPITest, "SendUIAPITest" ); |
|
630 _LIT( KBccAddressArray, "In BccAddressArray" ); |
|
631 TestModuleIf().Printf( 0, KSendUIAPITest, KBccAddressArray ); |
|
632 // Print to log file |
|
633 iLog->Log( KBccAddressArray); |
|
634 |
|
635 //Create the instance of CMessageData |
|
636 CMessageData* messagedata = InitL(); |
|
637 |
|
638 //Get the appended cc address count from cfg file |
|
639 TInt ccaddresscount; |
|
640 aItem.GetNextInt(ccaddresscount); |
|
641 |
|
642 //Get the cc address count from message data and compare |
|
643 if(ccaddresscount == messagedata->BccAddressArray().Count()) |
|
644 { |
|
645 return KErrNone; |
|
646 } |
|
647 else |
|
648 { |
|
649 return KErrGeneral; |
|
650 } |
|
651 } |
|
652 |
|
653 // ----------------------------------------------------------------------------- |
|
654 // CSendUIAPITest::?TestMessageDataSetBodyTextL |
|
655 // ?Test Case for Calling CMessageData's SetBodyTextL fun |
|
656 // (other items were commented in a header). |
|
657 // ----------------------------------------------------------------------------- |
|
658 // |
|
659 |
|
660 TInt CSendUIAPITest::TestMessageDataSetBodyTextL( CStifItemParser& aItem ) |
|
661 { |
|
662 // Print to UI |
|
663 _LIT( KSendUIAPITest, "SendUIAPITest" ); |
|
664 _LIT( KSetBodyTextL, "In SetBodyTextL" ); |
|
665 TestModuleIf().Printf( 0, KSendUIAPITest, KSetBodyTextL ); |
|
666 // Print to log file |
|
667 iLog->Log( KSetBodyTextL); |
|
668 |
|
669 //Create the instance of CMessageData |
|
670 CMessageData* messagedata = InitL(); |
|
671 //Get the Message body from cfg file |
|
672 TPtrC messagesubject; |
|
673 aItem.GetNextString(messagesubject); |
|
674 |
|
675 CEikonEnv* eikonEnv = CEikonEnv::Static(); |
|
676 //Create the rich text object |
|
677 CRichText* bodyText = CRichText::NewL( eikonEnv->SystemParaFormatLayerL(), |
|
678 eikonEnv->SystemCharFormatLayerL() ); |
|
679 CleanupStack::PushL( bodyText ); |
|
680 //Insert the text from cfg file to message body |
|
681 bodyText->InsertL( 0,messagesubject); |
|
682 |
|
683 TRAPD(err, messagedata->SetBodyTextL(bodyText)); |
|
684 if(err == KErrNone) |
|
685 { |
|
686 CleanupStack::PopAndDestroy( bodyText ); |
|
687 return KErrNone; |
|
688 } |
|
689 else |
|
690 { |
|
691 CleanupStack::PopAndDestroy( bodyText ); |
|
692 return err; |
|
693 } |
|
694 } |
|
695 |
|
696 // ----------------------------------------------------------------------------- |
|
697 // CSendUIAPITest::?TestMessageDataBodyTextL |
|
698 // ?Test Case for Calling CMessageData's BodyText fun |
|
699 // (other items were commented in a header). |
|
700 // ----------------------------------------------------------------------------- |
|
701 // |
|
702 |
|
703 TInt CSendUIAPITest::TestMessageDataBodyTextL( CStifItemParser& aItem ) |
|
704 { |
|
705 // Print to UI |
|
706 _LIT( KSendUIAPITest, "SendUIAPITest" ); |
|
707 _LIT( KBodyText, "In BodyText" ); |
|
708 TestModuleIf().Printf( 0, KSendUIAPITest, KBodyText ); |
|
709 // Print to log file |
|
710 iLog->Log( KBodyText); |
|
711 |
|
712 //Create the instance of CMessageData |
|
713 CMessageData* messagedata = InitL(); |
|
714 //Get the MessageBody text length |
|
715 TInt msgbodylen = messagedata->BodyText()->DocumentLength(); |
|
716 TInt len; |
|
717 aItem.GetNextInt(len); |
|
718 //If the length passed from cfg file and and Body text length same |
|
719 if(len == msgbodylen) |
|
720 { |
|
721 return KErrNone; |
|
722 } |
|
723 else |
|
724 { |
|
725 return KErrGeneral; |
|
726 } |
|
727 } |
|
728 |
|
729 // ----------------------------------------------------------------------------- |
|
730 // CSendUIAPITest::?TestAppendAttachmentHandleL |
|
731 // ?Test Case for Calling CMessageData's AppendAttachmentHandleL fun |
|
732 // (other items were commented in a header). |
|
733 // ----------------------------------------------------------------------------- |
|
734 // |
|
735 |
|
736 TInt CSendUIAPITest::TestAppendAttachmentHandleL( CStifItemParser& aItem ) |
|
737 { |
|
738 // Print to UI |
|
739 _LIT( KSendUIAPITest, "SendUIAPITest" ); |
|
740 _LIT( KAppendAttachmentHandleL, "In AppendAttachmentHandleL" ); |
|
741 TestModuleIf().Printf( 0, KSendUIAPITest, KAppendAttachmentHandleL ); |
|
742 // Print to log file |
|
743 iLog->Log( KAppendAttachmentHandleL); |
|
744 |
|
745 //Create the instance of CMessageData |
|
746 CMessageData* messagedata = InitL(); |
|
747 |
|
748 RFs fs; |
|
749 User::LeaveIfError(fs.Connect()); |
|
750 fs.ShareProtected(); |
|
751 RFile file; |
|
752 //Get the attachment from cfg file |
|
753 TPtrC attachfile; |
|
754 aItem.GetNextString(attachfile); |
|
755 TDesC attachfiledesc(attachfile); |
|
756 |
|
757 TBuf16<KFilePathSize> fileName; |
|
758 #ifdef __WINSCW__ |
|
759 _LIT( KTestFilePath, "c:\\Data\\TestData\\SendUIAPITest\\%S" ); |
|
760 fileName.Format( KTestFilePath, &attachfile ); |
|
761 #else |
|
762 TPtrC attachfilepath; |
|
763 aItem.GetNextString(attachfilepath); |
|
764 TDesC attachfilepathdesc(attachfilepath); |
|
765 fileName.Format( attachfilepath, &attachfile ); |
|
766 #endif |
|
767 |
|
768 //Open the file |
|
769 TInt err = file.Open(fs, fileName, EFileRead); |
|
770 if(err != KErrNone) |
|
771 { |
|
772 _LIT( KFileError, "Unable to Open File" ); |
|
773 iLog->Log(KFileError); |
|
774 fs.Close(); |
|
775 return err; |
|
776 } |
|
777 CleanupClosePushL(file); |
|
778 //Appends attachment handle to the array of attachment handles |
|
779 TRAPD(errtwo, messagedata->AppendAttachmentHandleL(file)); |
|
780 |
|
781 CleanupStack::PopAndDestroy( &file ); |
|
782 fs.Close(); |
|
783 if(errtwo == KErrNone) |
|
784 { |
|
785 return KErrNone; |
|
786 } |
|
787 else |
|
788 { |
|
789 return errtwo; |
|
790 } |
|
791 } |
|
792 |
|
793 // ----------------------------------------------------------------------------- |
|
794 // CSendUIAPITest::?TestAttachmentHandleArrayL |
|
795 // ?Test Case for Calling CMessageData's AttachmentHandleArray fun |
|
796 // return Array of attachment handles. |
|
797 // ----------------------------------------------------------------------------- |
|
798 // |
|
799 |
|
800 TInt CSendUIAPITest::TestAttachmentHandleArrayL( CStifItemParser& aItem ) |
|
801 { |
|
802 // Print to UI |
|
803 _LIT( KSendUIAPITest, "SendUIAPITest" ); |
|
804 _LIT( KAttachmentHandleArray, "In KAttachmentHandleArray" ); |
|
805 TestModuleIf().Printf( 0, KSendUIAPITest, KAttachmentHandleArray ); |
|
806 // Print to log file |
|
807 iLog->Log( KAttachmentHandleArray); |
|
808 |
|
809 //Create the instance of CMessageData |
|
810 CMessageData* messagedata = InitL(); |
|
811 |
|
812 //Get the count of AttachmentHandle from cfg file |
|
813 TInt attachmentHandleCnt; |
|
814 aItem.GetNextInt(attachmentHandleCnt); |
|
815 |
|
816 const RArray<RFile>& attachments = messagedata->AttachmentHandleArray(); |
|
817 //Compare the two counts |
|
818 if ( attachments.Count() == attachmentHandleCnt ) |
|
819 { |
|
820 return KErrNone; |
|
821 } |
|
822 else |
|
823 { |
|
824 return KErrGeneral; |
|
825 } |
|
826 } |
|
827 |
|
828 // ----------------------------------------------------------------------------- |
|
829 // CSendUIAPITest::?DataTypeL |
|
830 // ?Test Case for Calling CMessageData's DataType fun |
|
831 // return Data type id. |
|
832 // ----------------------------------------------------------------------------- |
|
833 // |
|
834 |
|
835 TInt CSendUIAPITest::TestDataTypeL( CStifItemParser& /*aItem*/ ) |
|
836 { |
|
837 // Print to UI |
|
838 _LIT( KSendUIAPITest, "SendUIAPITest" ); |
|
839 _LIT( KDataType, "In DataType" ); |
|
840 TestModuleIf().Printf( 0, KSendUIAPITest, KDataType ); |
|
841 // Print to log file |
|
842 iLog->Log( KDataType); |
|
843 |
|
844 //Create the instance of CMessageData |
|
845 CMessageData* messagedata = InitL(); |
|
846 TUid dType = messagedata->DataType() ; |
|
847 if ( dType != KNullUid ) |
|
848 { |
|
849 return KErrNone; |
|
850 } |
|
851 else |
|
852 { |
|
853 return KErrGeneral; |
|
854 } |
|
855 } |
|
856 |
|
857 // ----------------------------------------------------------------------------- |
|
858 // CSendUIAPITest::?ClearAddressesL |
|
859 // ?Test Case for Calling CMessageData's ClearAddresses fun |
|
860 // Clears all addressee arrays. |
|
861 // ----------------------------------------------------------------------------- |
|
862 // |
|
863 |
|
864 TInt CSendUIAPITest::ClearAddressesL( CStifItemParser& /*aItem*/ ) |
|
865 { |
|
866 // Print to UI |
|
867 _LIT( KSendUIAPITest, "SendUIAPITest" ); |
|
868 _LIT( KClearAddresses, "In ClearAddresses" ); |
|
869 TestModuleIf().Printf( 0, KSendUIAPITest, KClearAddresses ); |
|
870 // Print to log file |
|
871 iLog->Log( KClearAddresses); |
|
872 |
|
873 //Create the instance of CMessageData |
|
874 CMessageData* messagedata = InitL(); |
|
875 messagedata->ClearAddresses(); |
|
876 if ( messagedata->ToAddressArray().Count() == 0 ) |
|
877 { |
|
878 return KErrNone; |
|
879 } |
|
880 else |
|
881 { |
|
882 return KErrGeneral; |
|
883 } |
|
884 } |
|
885 // ----------------------------------------------------------------------------- |
|
886 // CSendUIAPITest::?TestExternalizeLnInternalizeL |
|
887 // ?Test Case for Calling CMessageData's ExternalizeL and InternalizeL funs |
|
888 // Externalizes and Internalize message data to and from stream |
|
889 // ----------------------------------------------------------------------------- |
|
890 // |
|
891 TInt CSendUIAPITest::TestExternalizeLnInternalizeL(CStifItemParser& aItem) |
|
892 { |
|
893 // Print to UI |
|
894 _LIT( KSendUIAPITest, "SendUIAPITest" ); |
|
895 _LIT( KTestExternalizeLnInternalizeL, "In TestExternalizeLnInternalizeL" ); |
|
896 TestModuleIf().Printf( 0, KSendUIAPITest, KTestExternalizeLnInternalizeL ); |
|
897 |
|
898 //Create the instance of CMessageData |
|
899 CMessageData* messagedata = InitL(); |
|
900 |
|
901 //Get the two suject from cfg file |
|
902 TPtrC subjectone; |
|
903 aItem.GetNextString(subjectone); |
|
904 TPtrC subjecttwo; |
|
905 aItem.GetNextString(subjecttwo); |
|
906 |
|
907 //Set the first subject to message data |
|
908 MsgDataSetSubjectL( subjectone); |
|
909 //Externalize the message data class so that first subject is stored |
|
910 ExternalizeL(); |
|
911 //Set the second subject to message data |
|
912 MsgDataSetSubjectL( subjecttwo ); |
|
913 //Internalize the message data class so that stored data can be retrived |
|
914 InternalizeL(); |
|
915 //Get the message-data class stored data and compare with the one stored earlier |
|
916 if(MsgDataCompSubjectL(subjectone) == KErrNone) |
|
917 { |
|
918 //Twwo datas are same |
|
919 return KErrNone; |
|
920 } |
|
921 else |
|
922 { |
|
923 //Twwo datas differ |
|
924 return KErrGeneral; |
|
925 } |
|
926 } |
|
927 |
|
928 // ----------------------------------------------------------------------------- |
|
929 // CSendUIAPITest::?ExternalizeL |
|
930 // ?Test Case for Calling CMessageData's ExternalizeL fun |
|
931 // Externalizes message data to a stream |
|
932 // ----------------------------------------------------------------------------- |
|
933 // |
|
934 |
|
935 TInt CSendUIAPITest::ExternalizeL(void) |
|
936 { |
|
937 // Print to UI |
|
938 _LIT( KSendUIAPITest, "SendUIAPITest" ); |
|
939 _LIT( KExternalizeL, "In ExternalizeL" ); |
|
940 TestModuleIf().Printf( 0, KSendUIAPITest, KExternalizeL ); |
|
941 // Print to log file |
|
942 iLog->Log( KExternalizeL); |
|
943 |
|
944 ibuffer = CBufFlat::NewL( KMessageBufferSize ); |
|
945 CleanupStack::PushL( ibuffer ); |
|
946 //Create a Read Buffer Stream |
|
947 RBufWriteStream bufStream; |
|
948 //Open the Stream |
|
949 bufStream.Open( *ibuffer ); |
|
950 //Externalise the MessageData object |
|
951 TRAPD(err , iMessageData->ExternalizeL(bufStream )); |
|
952 //Comit and Close the Write Stream |
|
953 bufStream.CommitL(); |
|
954 bufStream.Close(); |
|
955 CleanupStack::Pop( ibuffer ); |
|
956 if(err == KErrNone) |
|
957 { |
|
958 return KErrNone; |
|
959 } |
|
960 else |
|
961 { |
|
962 return err; |
|
963 } |
|
964 } |
|
965 |
|
966 // ----------------------------------------------------------------------------- |
|
967 // CSendUIAPITest::?InternalizeL |
|
968 // ?Test Case for Calling CMessageData's InternalizeL fun |
|
969 // Internalizes message data to from a stream |
|
970 // ----------------------------------------------------------------------------- |
|
971 // |
|
972 |
|
973 TInt CSendUIAPITest::InternalizeL(void) |
|
974 { |
|
975 // Print to UI |
|
976 _LIT( KSendUIAPITest, "SendUIAPITest" ); |
|
977 _LIT( KInternalizeL, "In InternalizeL" ); |
|
978 TestModuleIf().Printf( 0, KSendUIAPITest, KInternalizeL ); |
|
979 // Print to log file |
|
980 iLog->Log( KInternalizeL); |
|
981 |
|
982 //Create the Read stream and Open it |
|
983 RBufReadStream bufStream; |
|
984 bufStream.Open(*ibuffer); |
|
985 //Internalise the MessageData Object |
|
986 TRAPD(err, iMessageData->InternalizeL(bufStream)); |
|
987 //Release and Close the Read Stream |
|
988 bufStream.Release(); |
|
989 bufStream.Close(); |
|
990 delete ibuffer; |
|
991 if(err == KErrNone) |
|
992 { |
|
993 return KErrNone; |
|
994 } |
|
995 else |
|
996 { |
|
997 return err; |
|
998 } |
|
999 } |
|
1000 |
|
1001 // ----------------------------------------------------------------------------- |
|
1002 // CSendUIAPITest::?TestSetOpaqueDataL |
|
1003 // ?Test Case for Calling CMessageData's SetOpaqueDataL fun |
|
1004 // Set opaque data |
|
1005 // ----------------------------------------------------------------------------- |
|
1006 // |
|
1007 |
|
1008 TInt CSendUIAPITest::TestSetOpaqueDataL( CStifItemParser& aItem ) |
|
1009 { |
|
1010 // Print to UI |
|
1011 _LIT( KSendUIAPITest, "SendUIAPITest" ); |
|
1012 _LIT( KSetOpaqueDataL, "In SetOpaqueDataL" ); |
|
1013 TestModuleIf().Printf( 0, KSendUIAPITest, KSetOpaqueDataL ); |
|
1014 // Print to log file |
|
1015 iLog->Log( KSetOpaqueDataL); |
|
1016 |
|
1017 //Create the instance of CMessageData |
|
1018 CMessageData* messagedata = InitL(); |
|
1019 |
|
1020 TPtrC data; |
|
1021 //Get the opaque data from cfg file |
|
1022 aItem.GetNextString(data); |
|
1023 // Copy the data to Tbuf8 |
|
1024 TBuf8<KMessageBufferSize> opaqueData; |
|
1025 opaqueData.Copy(data); |
|
1026 |
|
1027 TUid dType = messagedata->DataType() ; |
|
1028 //Set the Opaque Data to MessageData |
|
1029 TRAPD( err , messagedata->SetOpaqueDataL(&opaqueData, dType )); |
|
1030 if(err == KErrNone) |
|
1031 { |
|
1032 return KErrNone; |
|
1033 } |
|
1034 else |
|
1035 { |
|
1036 return err; |
|
1037 } |
|
1038 } |
|
1039 |
|
1040 // ----------------------------------------------------------------------------- |
|
1041 // CSendUIAPITest::?TestOpaqueDataL |
|
1042 // ?Test Case for Calling CMessageData's OpaqueData fun |
|
1043 // Get opaque data |
|
1044 // ----------------------------------------------------------------------------- |
|
1045 // |
|
1046 |
|
1047 TInt CSendUIAPITest::TestOpaqueDataL( CStifItemParser& aItem ) |
|
1048 { |
|
1049 // Print to UI |
|
1050 _LIT( KSendUIAPITest, "SendUIAPITest" ); |
|
1051 _LIT( KOpaqueData, "In OpaqueData" ); |
|
1052 TestModuleIf().Printf( 0, KSendUIAPITest, KOpaqueData ); |
|
1053 // Print to log file |
|
1054 iLog->Log( KOpaqueData); |
|
1055 |
|
1056 //Create the instance of CMessageData |
|
1057 CMessageData* messagedata = InitL(); |
|
1058 TPtrC data; |
|
1059 //Get the opaque data to compare from cfg file |
|
1060 aItem.GetNextString(data); |
|
1061 // Copy the data to Tbuf8 |
|
1062 TBuf8<KMessageBufferSize> opaqueData; |
|
1063 opaqueData.Copy(data); |
|
1064 //Get the opaque data from MessageData |
|
1065 TPtrC8 ptr = messagedata->OpaqueData(); |
|
1066 //Compare the two values |
|
1067 if(ptr.Compare(opaqueData) == 0) |
|
1068 { |
|
1069 return KErrNone; |
|
1070 } |
|
1071 else |
|
1072 { |
|
1073 return KErrGeneral; |
|
1074 } |
|
1075 } |
|
1076 |
|
1077 // ----------------------------------------------------------------------------- |
|
1078 // CSendUIAPITest::?TestCMessageAddressNewL |
|
1079 // ?Test Case for Two-phased constructor |
|
1080 // ----------------------------------------------------------------------------- |
|
1081 // |
|
1082 |
|
1083 TInt CSendUIAPITest::TestCMessageAddressNewL( CStifItemParser& /*aItem*/ ) |
|
1084 { |
|
1085 // Print to UI |
|
1086 _LIT( KSendUIAPITest, "SendUIAPITest CMessageAddress" ); |
|
1087 _LIT( KCMessageAddressNewL, "In TestCMessageAddressNewL" ); |
|
1088 TestModuleIf().Printf( 0, KSendUIAPITest, KCMessageAddressNewL ); |
|
1089 // Print to log file |
|
1090 iLog->Log( KCMessageAddressNewL); |
|
1091 |
|
1092 //Construct CMessageAddress object |
|
1093 iMessageAddress = CMessageAddress::NewL(); |
|
1094 if(iMessageAddress) |
|
1095 { |
|
1096 _LIT( KCMessageAddressNewL, "CMessageAddress NewL succesfulley called" ); |
|
1097 iLog->Log( KCMessageAddressNewL); |
|
1098 return KErrNone; |
|
1099 } |
|
1100 else |
|
1101 { |
|
1102 _LIT( KCMessageAddressNewLFail, "CMessageAddress NewL failed" ); |
|
1103 iLog->Log( KCMessageAddressNewLFail); |
|
1104 return KErrGeneral; |
|
1105 } |
|
1106 } |
|
1107 |
|
1108 // ----------------------------------------------------------------------------- |
|
1109 // CSendUIAPITest::?TestMsgAdrsSetAddressL |
|
1110 // ?Test Case for API SetAddressL that Sets real address |
|
1111 // ----------------------------------------------------------------------------- |
|
1112 // |
|
1113 |
|
1114 TInt CSendUIAPITest::TestMsgAdrsSetAddressL( CStifItemParser& aItem ) |
|
1115 { |
|
1116 // Print to UI |
|
1117 _LIT( KSendUIAPITest, "SendUIAPITest CMessageAddress" ); |
|
1118 _LIT( KCMessageAddressSetAddressL, "In TestCMessageAddressSetAddressL" ); |
|
1119 TestModuleIf().Printf( 0, KSendUIAPITest, KCMessageAddressSetAddressL ); |
|
1120 // Print to log file |
|
1121 iLog->Log( KCMessageAddressSetAddressL); |
|
1122 TPtrC address; |
|
1123 //Get the address from cfg file |
|
1124 aItem.GetNextString(address); |
|
1125 //Set the same address to CMessageAddress object |
|
1126 TRAPD( err, iMessageAddress->SetAddressL( address )); |
|
1127 if(err == KErrNone) |
|
1128 { |
|
1129 return KErrNone; |
|
1130 } |
|
1131 else |
|
1132 { |
|
1133 return err; |
|
1134 } |
|
1135 } |
|
1136 |
|
1137 // ----------------------------------------------------------------------------- |
|
1138 // CSendUIAPITest::?TestMsgAdrsAddress |
|
1139 // ?Test Case for API Address that get real address |
|
1140 // ----------------------------------------------------------------------------- |
|
1141 // |
|
1142 |
|
1143 TInt CSendUIAPITest::TestMsgAdrsAddress( CStifItemParser& aItem ) |
|
1144 { |
|
1145 // Print to UI |
|
1146 _LIT( KSendUIAPITest, "SendUIAPITest CMessageAddress" ); |
|
1147 _LIT( KCMessageAddressAddress, "In TestCMessageAddressAddress" ); |
|
1148 TestModuleIf().Printf( 0, KSendUIAPITest, KCMessageAddressAddress ); |
|
1149 // Print to log file |
|
1150 iLog->Log( KCMessageAddressAddress); |
|
1151 |
|
1152 TPtrC address; |
|
1153 ////Get the address from cfg file |
|
1154 aItem.GetNextString(address); |
|
1155 //Get the address in CMessageAddress and compare with above |
|
1156 if(iMessageAddress->Address().Compare(address) == 0 ) |
|
1157 { |
|
1158 return KErrNone; |
|
1159 } |
|
1160 else |
|
1161 { |
|
1162 return KErrGeneral; |
|
1163 } |
|
1164 } |
|
1165 |
|
1166 // ----------------------------------------------------------------------------- |
|
1167 // CSendUIAPITest::?TestMsgAdrsSetAliasL |
|
1168 // ?Test Case for API SetAliasL that Sets alias for the real address. |
|
1169 // ----------------------------------------------------------------------------- |
|
1170 // |
|
1171 |
|
1172 TInt CSendUIAPITest::TestMsgAdrsSetAliasL( CStifItemParser& aItem ) |
|
1173 { |
|
1174 // Print to UI |
|
1175 _LIT( KSendUIAPITest, "SendUIAPITest CMessageAddress" ); |
|
1176 _LIT( KCMessageAddressSetAliasL, "In TestCMessageAddressSetAliasL" ); |
|
1177 TestModuleIf().Printf( 0, KSendUIAPITest, KCMessageAddressSetAliasL ); |
|
1178 // Print to log file |
|
1179 iLog->Log( KCMessageAddressSetAliasL); |
|
1180 TPtrC alias; |
|
1181 //Get the alias for address from cfg file |
|
1182 aItem.GetNextString(alias); |
|
1183 //Set the alias to CMessageAddress's address |
|
1184 TRAPD( err, iMessageAddress->SetAliasL( alias )); |
|
1185 if(err == KErrNone) |
|
1186 { |
|
1187 return KErrNone; |
|
1188 } |
|
1189 else |
|
1190 { |
|
1191 return err; |
|
1192 } |
|
1193 } |
|
1194 |
|
1195 // ----------------------------------------------------------------------------- |
|
1196 // CSendUIAPITest::?TestMsgAdrsAliasL |
|
1197 // ?Test Case for API Alias that returns alias for the address. |
|
1198 // ----------------------------------------------------------------------------- |
|
1199 // |
|
1200 |
|
1201 TInt CSendUIAPITest::TestMsgAdrsAlias( CStifItemParser& aItem ) |
|
1202 { |
|
1203 // Print to UI |
|
1204 _LIT( KSendUIAPITest, "SendUIAPITest CMessageAddress" ); |
|
1205 _LIT( KCMessageAddressAlias, "In TestCMessageAddressAlias" ); |
|
1206 TestModuleIf().Printf( 0, KSendUIAPITest, KCMessageAddressAlias ); |
|
1207 // Print to log file |
|
1208 iLog->Log( KCMessageAddressAlias); |
|
1209 |
|
1210 TPtrC alias; |
|
1211 ////Get the address from cfg file |
|
1212 aItem.GetNextString(alias); |
|
1213 //Get the address in CMessageAddress and compare with above |
|
1214 if(iMessageAddress->Alias().Compare(alias) == 0 ) |
|
1215 { |
|
1216 return KErrNone; |
|
1217 } |
|
1218 else |
|
1219 { |
|
1220 return KErrGeneral; |
|
1221 } |
|
1222 } |
|
1223 |
|
1224 // ----------------------------------------------------------------------------- |
|
1225 // CSendUIAPITest::?TestMsgAdrsExternalizeL |
|
1226 // ?Test Case for API ExternalizeL that Externalizes address data to a stream |
|
1227 // ----------------------------------------------------------------------------- |
|
1228 // |
|
1229 |
|
1230 TInt CSendUIAPITest::TestMsgAdrsExternalizeL( CStifItemParser& /*aItem*/ ) |
|
1231 { |
|
1232 // Print to UI |
|
1233 _LIT( KSendUIAPITest, "SendUIAPITest CMessageAddress" ); |
|
1234 _LIT( KCMessageAddressExternalizeL, "In TestCMessageAddressExternalizeL" ); |
|
1235 TestModuleIf().Printf( 0, KSendUIAPITest, KCMessageAddressExternalizeL ); |
|
1236 // Print to log file |
|
1237 iLog->Log( KCMessageAddressExternalizeL); |
|
1238 |
|
1239 iMsgAdrbuffer = CBufFlat::NewL( KMessageBufferSize ); |
|
1240 |
|
1241 //Create a Read Buffer Stream |
|
1242 RBufWriteStream bufStream; |
|
1243 //Open the Stream |
|
1244 bufStream.Open( *iMsgAdrbuffer ); |
|
1245 //Externalise the MessageData object |
|
1246 TRAPD(err , iMessageAddress->ExternalizeL(bufStream )); |
|
1247 //Comit and Close the Write Stream |
|
1248 bufStream.CommitL(); |
|
1249 bufStream.Close(); |
|
1250 |
|
1251 if(err == KErrNone) |
|
1252 { |
|
1253 return KErrNone; |
|
1254 } |
|
1255 else |
|
1256 { |
|
1257 return err; |
|
1258 } |
|
1259 } |
|
1260 |
|
1261 // ----------------------------------------------------------------------------- |
|
1262 // CSendUIAPITest::?TestMsgAdrsInternalizeL |
|
1263 // ?Test Case for API InternalizeL that Internalizes message data from a stream |
|
1264 // ----------------------------------------------------------------------------- |
|
1265 // |
|
1266 |
|
1267 TInt CSendUIAPITest::TestMsgAdrsInternalizeL( CStifItemParser& /*aItem*/ ) |
|
1268 { |
|
1269 // Print to UI |
|
1270 _LIT( KSendUIAPITest, "SendUIAPITest CMessageAddress" ); |
|
1271 _LIT( KCMessageAddressInternalizeL, "In TestCMessageAddressInternalizeL" ); |
|
1272 TestModuleIf().Printf( 0, KSendUIAPITest, KCMessageAddressInternalizeL ); |
|
1273 // Print to log file |
|
1274 iLog->Log( KCMessageAddressInternalizeL); |
|
1275 |
|
1276 RBufReadStream bufStream; |
|
1277 bufStream.Open(*iMsgAdrbuffer); |
|
1278 //Internalise the MessageData Object |
|
1279 TRAPD(err, iMessageAddress->InternalizeL(bufStream)); |
|
1280 //Release and Close the Read Stream |
|
1281 bufStream.Release(); |
|
1282 bufStream.Close(); |
|
1283 if(iMsgAdrbuffer) |
|
1284 { |
|
1285 delete iMsgAdrbuffer; |
|
1286 iMsgAdrbuffer = NULL; |
|
1287 } |
|
1288 if(err == KErrNone) |
|
1289 { |
|
1290 return KErrNone; |
|
1291 } |
|
1292 else |
|
1293 { |
|
1294 return err; |
|
1295 } |
|
1296 } |
|
1297 |
|
1298 // ----------------------------------------------------------------------------- |
|
1299 // CSendUIAPITest::?TestTSendingCapabilities |
|
1300 // ?Test Case for functions in TSendingCapabilities |
|
1301 // ----------------------------------------------------------------------------- |
|
1302 // |
|
1303 |
|
1304 TInt CSendUIAPITest::TestTSendingCapabilities( CStifItemParser& /*aItem*/ ) |
|
1305 { |
|
1306 //print to UI |
|
1307 _LIT( KSendUIAPITest, "SendUIAPITest TSendingCapabilities" ); |
|
1308 _LIT( KTSendingCapabilities, "In TestTSendingCapabilities" ); |
|
1309 TestModuleIf().Printf( 0, KSendUIAPITest, KTSendingCapabilities ); |
|
1310 // Print to log file |
|
1311 iLog->Log( KTSendingCapabilities); |
|
1312 |
|
1313 _LIT( KTSendingCapabilitiesObj, "Creating TSendingCapabilities Object" ); |
|
1314 iLog->Log( KTSendingCapabilitiesObj); |
|
1315 |
|
1316 _LIT( KTSendingCapabilitiesCtor, "Calling TSendingCapabilities Constructor" ); |
|
1317 iLog->Log( KTSendingCapabilitiesCtor); |
|
1318 |
|
1319 //Create TSendingCapabilities Object |
|
1320 TSendingCapabilities capabilitiesone; |
|
1321 |
|
1322 _LIT( KTSendingCapabilitiesCtord, "TSendingCapabilities Constructor called successfully" ); |
|
1323 iLog->Log( KTSendingCapabilitiesCtord); |
|
1324 |
|
1325 _LIT( KTSendingCapabilitiesParamCtor, "Calling TSendingCapabilities Paramaterised Constructor" ); |
|
1326 iLog->Log( KTSendingCapabilitiesParamCtor); |
|
1327 |
|
1328 //Create TSendingCapabilities Object with parameters |
|
1329 TSendingCapabilities capabilitiestwo = TSendingCapabilities( 0, KMaxTInt, |
|
1330 TSendingCapabilities::ESupportsAttachments ); |
|
1331 |
|
1332 _LIT( KTSendingCapabilitiesParamCtord, "TSendingCapabilities Paramaterised Constructor called successfully" ); |
|
1333 iLog->Log( KTSendingCapabilitiesParamCtord); |
|
1334 |
|
1335 //Create another TSendingCapabilities Object with parameters |
|
1336 TSendingCapabilities capabilitiesthree = TSendingCapabilities( 0, KMaxTInt, |
|
1337 TSendingCapabilities::ESupportsAttachments ); |
|
1338 |
|
1339 _LIT( KTSendingCapabilitiesEqualOptr, "Calling TSendingCapabilities EqualTo Operator" ); |
|
1340 iLog->Log( KTSendingCapabilitiesEqualOptr); |
|
1341 |
|
1342 //Comapre the two object with Equal to operator |
|
1343 if( capabilitiestwo == capabilitiesthree ) |
|
1344 { |
|
1345 _LIT( KTSendingCapabilitiesEqual, "Two TSendingCapabilities Objects are Equal" ); |
|
1346 iLog->Log( KTSendingCapabilitiesEqual); |
|
1347 } |
|
1348 _LIT( KTSendingCapabilitiesNotEqualOptr, "Calling TSendingCapabilities Not EqualTo Operator" ); |
|
1349 iLog->Log( KTSendingCapabilitiesNotEqualOptr); |
|
1350 |
|
1351 //Comapre the two object with Not Equal to operator |
|
1352 if( capabilitiesone != capabilitiestwo ) |
|
1353 { |
|
1354 _LIT( KTSendingCapabilitiesNotEqual, "Two TSendingCapabilities Objects are Not Equal" ); |
|
1355 iLog->Log( KTSendingCapabilitiesNotEqual); |
|
1356 } |
|
1357 return KErrNone; |
|
1358 } |
|
1359 |
|
1360 // ----------------------------------------------------------------------------- |
|
1361 // CSendUIAPITest::TestCopyLC |
|
1362 // Test SetServiceMenuNameL,SetServiceAddressL,SetServiceNameL,SetServiceFeatures and |
|
1363 // CopyLCtest method function. |
|
1364 // ----------------------------------------------------------------------------- |
|
1365 // |
|
1366 TInt CSendUIAPITest::TestCopyLC( CStifItemParser& /*aItem*/ ) |
|
1367 { |
|
1368 //print to UI |
|
1369 _LIT( KSendUIAPITest, "SendUIAPITest CSendingServiceInfo" ); |
|
1370 _LIT( KTestCopyLC, "In TestCopyLC" ); |
|
1371 TestModuleIf().Printf( 0, KSendUIAPITest, KTestCopyLC ); |
|
1372 // Print to log file |
|
1373 iLog->Log( KTestCopyLC); |
|
1374 |
|
1375 _LIT( KNewL, "Calling CSendingServiceInfo::NewL" ); |
|
1376 iLog->Log( KNewL); |
|
1377 //Create the CSendingServiceInfo var |
|
1378 CSendingServiceInfo* serviceInfo = CSendingServiceInfo::NewL(); |
|
1379 |
|
1380 _LIT( KSetServiceMenuNameL, "Calling CSendingServiceInfo's SetServiceMenuNameL" ); |
|
1381 iLog->Log( KSetServiceMenuNameL); |
|
1382 serviceInfo->SetServiceMenuNameL( KTestText ); |
|
1383 |
|
1384 _LIT( KSetServiceAddressL, "Calling CSendingServiceInfo's SetServiceAddressL" ); |
|
1385 iLog->Log( KSetServiceAddressL); |
|
1386 serviceInfo->SetServiceAddressL( KTestText ); |
|
1387 |
|
1388 _LIT( KSetServiceNameL, "Calling CSendingServiceInfo's SetServiceNameL" ); |
|
1389 iLog->Log( KSetServiceNameL); |
|
1390 serviceInfo->SetServiceNameL( KTestText ); |
|
1391 |
|
1392 _LIT( KSetServiceFeatures, "Calling CSendingServiceInfo's SetServiceFeatures" ); |
|
1393 iLog->Log( KSetServiceFeatures); |
|
1394 serviceInfo->SetServiceFeatures( CSendingServiceInfo::EServiceInValid |
|
1395 | CSendingServiceInfo::EServiceHidden |
|
1396 | CSendingServiceInfo::EServiceCanSendDirectly ); |
|
1397 |
|
1398 _LIT( KCopyLC, "Calling CSendingServiceInfo's CopyLC" ); |
|
1399 iLog->Log( KCopyLC); |
|
1400 CSendingServiceInfo* copy; |
|
1401 copy = serviceInfo->CopyLC(); |
|
1402 |
|
1403 //TPtrC |
|
1404 if ( serviceInfo->ServiceName().Compare( copy->ServiceName() ) != 0 || |
|
1405 serviceInfo->ServiceMenuName().Compare( copy->ServiceMenuName() ) != 0 || |
|
1406 serviceInfo->ServiceAddress().Compare( copy->ServiceAddress() ) != 0 || |
|
1407 serviceInfo->ServiceFeatures() != copy->ServiceFeatures() ) |
|
1408 { |
|
1409 iLog->Log( _L("CopyLC failed")); |
|
1410 } |
|
1411 |
|
1412 CleanupStack::PopAndDestroy( copy ); |
|
1413 delete serviceInfo; |
|
1414 |
|
1415 return KErrNone; |
|
1416 } |
|
1417 |
|
1418 // ----------------------------------------------------------------------------- |
|
1419 // CSendUIAPITest::TestSetTechnologyTypeId |
|
1420 // SetTechnologyTypeId test method function. |
|
1421 // ----------------------------------------------------------------------------- |
|
1422 // |
|
1423 |
|
1424 TInt CSendUIAPITest::TestSetTechnologyTypeIdL( CStifItemParser& /*aItem*/ ) |
|
1425 { |
|
1426 //print to UI |
|
1427 _LIT( KSendUIAPITest, "SendUIAPITest CSendingServiceInfo" ); |
|
1428 _LIT( KTestSetTechnologyTypeId, "In TestSetTechnologyTypeId" ); |
|
1429 TestModuleIf().Printf( 0, KSendUIAPITest, KTestSetTechnologyTypeId ); |
|
1430 // Print to log file |
|
1431 iLog->Log( KTestSetTechnologyTypeId); |
|
1432 |
|
1433 //Create the CSendingServiceInfo Object |
|
1434 CSendingServiceInfo* serviceInfo = CSendingServiceInfo::NewL(); |
|
1435 _LIT( KCSendingServiceInfoObj, "CSendingServiceInfo Object created" ); |
|
1436 iLog->Log( KCSendingServiceInfoObj); |
|
1437 |
|
1438 _LIT( KSetTechnologyTypeId, "Calling CSendingServiceInfo SetTechnologyTypeId" ); |
|
1439 iLog->Log( KSetTechnologyTypeId); |
|
1440 serviceInfo->SetTechnologyTypeId( KServideId ); |
|
1441 |
|
1442 _LIT( KTechnologyTypeId, "Calling CSendingServiceInfo TechnologyTypeId" ); |
|
1443 iLog->Log( KTechnologyTypeId); |
|
1444 //Compare the Technology ID |
|
1445 if ( serviceInfo->TechnologyTypeId() != KServideId ) |
|
1446 { |
|
1447 delete serviceInfo; |
|
1448 return KErrCancel; |
|
1449 } |
|
1450 else |
|
1451 { |
|
1452 delete serviceInfo; |
|
1453 return KErrNone; |
|
1454 } |
|
1455 } |
|
1456 // ----------------------------------------------------------------------------- |
|
1457 // CSendUIAPITest::TestServiceID |
|
1458 // ServiceID test method function. |
|
1459 // ----------------------------------------------------------------------------- |
|
1460 // |
|
1461 |
|
1462 TInt CSendUIAPITest::TestServiceIDL( CStifItemParser& /*aItem*/ ) |
|
1463 { |
|
1464 //print to UI |
|
1465 _LIT( KSendUIAPITest, "SendUIAPITest CSendingServiceInfo" ); |
|
1466 _LIT( KTestServiceID, "In TestServiceID" ); |
|
1467 TestModuleIf().Printf( 0, KSendUIAPITest, KTestServiceID ); |
|
1468 // Print to log file |
|
1469 iLog->Log( KTestServiceID); |
|
1470 |
|
1471 TUid id(KDrmLinkSender); |
|
1472 //Create the CSendingServiceInfo var |
|
1473 CSendingServiceInfo* serviceInfo = CSendingServiceInfo::NewL(); |
|
1474 |
|
1475 _LIT( KSetServiceId, "Calling CSendingServiceInfo SetServiceId" ); |
|
1476 iLog->Log( KSetServiceId); |
|
1477 serviceInfo->SetServiceId( id ); |
|
1478 //Compare the ServiceID's |
|
1479 if( serviceInfo->ServiceId() != id ) |
|
1480 { |
|
1481 delete serviceInfo; |
|
1482 return KErrCancel; |
|
1483 } |
|
1484 else |
|
1485 { |
|
1486 delete serviceInfo; |
|
1487 return KErrNone; |
|
1488 } |
|
1489 } |
|
1490 |
|
1491 // ----------------------------------------------------------------------------- |
|
1492 // CSendUIAPITest::TestServiceProviderID |
|
1493 // ServiceProviderID test method function. |
|
1494 // ----------------------------------------------------------------------------- |
|
1495 // |
|
1496 |
|
1497 TInt CSendUIAPITest::TestServiceProviderIDL( CStifItemParser& /*aItem*/ ) |
|
1498 { |
|
1499 //print to UI |
|
1500 _LIT( KSendUIAPITest, "SendUIAPITest CSendingServiceInfo" ); |
|
1501 _LIT( KTestServiceProviderID, "In TestServiceProviderID" ); |
|
1502 TestModuleIf().Printf( 0, KSendUIAPITest, KTestServiceProviderID ); |
|
1503 // Print to log file |
|
1504 iLog->Log( KTestServiceProviderID); |
|
1505 TUid id(KDrmLinkSender); |
|
1506 //Create the CSendingServiceInfo var |
|
1507 CSendingServiceInfo* serviceInfo = CSendingServiceInfo::NewL(); |
|
1508 |
|
1509 _LIT( KSetServiceProviderId, "Calling CSendingServiceInfo SetServiceProviderId" ); |
|
1510 iLog->Log( KSetServiceProviderId); |
|
1511 serviceInfo->SetServiceProviderId( id ); |
|
1512 //Compare the ServiceProviderID's |
|
1513 if( serviceInfo->ServiceProviderId() != id ) |
|
1514 { |
|
1515 delete serviceInfo; |
|
1516 return KErrCancel; |
|
1517 } |
|
1518 else |
|
1519 { |
|
1520 delete serviceInfo; |
|
1521 return KErrNone; |
|
1522 } |
|
1523 } |
|
1524 |
|
1525 // ----------------------------------------------------------------------------- |
|
1526 // CSendUIAPITest::TestServiceCapabilities |
|
1527 // ServiceCapabilities test method function. |
|
1528 // ----------------------------------------------------------------------------- |
|
1529 // |
|
1530 |
|
1531 TInt CSendUIAPITest::TestServiceCapabilitiesL( CStifItemParser& /*aItem*/ ) |
|
1532 { |
|
1533 //print to UI |
|
1534 _LIT( KSendUIAPITest, "SendUIAPITest CSendingServiceInfo" ); |
|
1535 _LIT( KTestServiceCapabilities, "In TestServiceCapabilities" ); |
|
1536 TestModuleIf().Printf( 0, KSendUIAPITest, KTestServiceCapabilities ); |
|
1537 // Print to log file |
|
1538 iLog->Log( KTestServiceCapabilities); |
|
1539 //Create the Capabilities |
|
1540 TSendingCapabilities cap(10,100,TSendingCapabilities::EAllServices); |
|
1541 //Create the CSendingServiceInfo var |
|
1542 CSendingServiceInfo* serviceInfo = CSendingServiceInfo::NewL(); |
|
1543 |
|
1544 _LIT( KSetServiceCapabilities, "Calling CSendingServiceInfo SetServiceCapabilities" ); |
|
1545 iLog->Log( KSetServiceCapabilities); |
|
1546 serviceInfo->SetServiceCapabilities( cap ); |
|
1547 //Compare the ServiceCapabilities |
|
1548 if( serviceInfo->ServiceCapabilities() != cap ) |
|
1549 { |
|
1550 delete serviceInfo; |
|
1551 return KErrCancel; |
|
1552 } |
|
1553 else |
|
1554 { |
|
1555 delete serviceInfo; |
|
1556 return KErrNone; |
|
1557 } |
|
1558 } |
|
1559 |
|
1560 |
|
1561 // ----------------------------------------------------------------------------- |
|
1562 // CSendUIAPITest::TestCSendUIAddSendMenuItemLL |
|
1563 // Test method for CSendUI AddSendMenuItemL launched |
|
1564 // (other items were commented in a header). |
|
1565 // ----------------------------------------------------------------------------- |
|
1566 // |
|
1567 |
|
1568 TInt CSendUIAPITest::TestCSendUIAddSendMenuItemLL( CStifItemParser& /*aItem*/ ) |
|
1569 { |
|
1570 |
|
1571 // Print to UI |
|
1572 _LIT( KSendUIAPITest, "SendUIAPITest CSendUI" ); |
|
1573 _LIT( KTestCSendUIAddSendMenuItemLL, "In TestCSendUIAddSendMenuItemLL" ); |
|
1574 TestModuleIf().Printf( 0, KSendUIAPITest, KTestCSendUIAddSendMenuItemLL ); |
|
1575 // Print to log file |
|
1576 iLog->Log( KTestCSendUIAddSendMenuItemLL ); |
|
1577 |
|
1578 MEikMenuObserver* menuObserver = new(ELeave)FakeObserver(); |
|
1579 |
|
1580 CEikMenuPane* menuPane = new(ELeave)CEikMenuPane(menuObserver); |
|
1581 |
|
1582 _LIT( KSetServiceCapabilities, "Calling CSendUI AddSendMenuItemL" ); |
|
1583 iLog->Log( KSetServiceCapabilities); |
|
1584 |
|
1585 TRAPD(err,iSendUi->AddSendMenuItemL( *menuPane, 0, 99, KCapabilitiesForAllServices)); |
|
1586 //Delete the MenoObserver and MenuPane |
|
1587 delete(menuObserver); |
|
1588 delete(menuPane); |
|
1589 |
|
1590 if(err == KErrNone) |
|
1591 { |
|
1592 _LIT( KSetServiceCapabilities, "CSendUI AddSendMenuItemL is successfully called" ); |
|
1593 iLog->Log( KSetServiceCapabilities); |
|
1594 return KErrNone; |
|
1595 } |
|
1596 else |
|
1597 { |
|
1598 _LIT( KSetServiceCapabilities, "CSendUI AddSendMenuItemL has left" ); |
|
1599 iLog->Log( KSetServiceCapabilities); |
|
1600 return KErrGeneral; |
|
1601 } |
|
1602 |
|
1603 } |
|
1604 |
|
1605 // ----------------------------------------------------------------------------- |
|
1606 // CSendUIAPITest::TestCSendUINewLCL |
|
1607 // Test method for CSendUI NewLC |
|
1608 // (other items were commented in a header). |
|
1609 // ----------------------------------------------------------------------------- |
|
1610 // |
|
1611 |
|
1612 TInt CSendUIAPITest::TestCSendUINewLCL( CStifItemParser& /*aItem*/ ) |
|
1613 { |
|
1614 |
|
1615 // Print to UI |
|
1616 _LIT( KSendUIAPITest, "SendUIAPITest CSendUI" ); |
|
1617 _LIT( KTestCSendUINewLCL, "In TestCSendUINewLCL" ); |
|
1618 TestModuleIf().Printf( 0, KSendUIAPITest, KTestCSendUINewLCL ); |
|
1619 // Print to log file |
|
1620 iLog->Log( KTestCSendUINewLCL ); |
|
1621 |
|
1622 //Call CSendUI NewLC |
|
1623 CSendUi* SendUi = CSendUi::NewLC(); |
|
1624 |
|
1625 CleanupStack::PopAndDestroy(SendUi); |
|
1626 return KErrNone; |
|
1627 } |
|
1628 |
|
1629 // ----------------------------------------------------------------------------- |
|
1630 // CSendUIAPITest::TestCSendUIShowQueryAndSendLL |
|
1631 // Test method for CSendUI ShowQueryAndSendL |
|
1632 // (other items were commented in a header). |
|
1633 // ----------------------------------------------------------------------------- |
|
1634 // |
|
1635 |
|
1636 TInt CSendUIAPITest::TestCSendUIShowQueryAndSendLL( CStifItemParser& /*aItem*/ ) |
|
1637 { |
|
1638 |
|
1639 // Print to UI |
|
1640 _LIT( KSendUIAPITest, "SendUIAPITest CSendUI" ); |
|
1641 _LIT( KTestCSendUIShowQueryAndSendLL, "In TestCSendUIShowQueryAndSendLL" ); |
|
1642 TestModuleIf().Printf( 0, KSendUIAPITest, KTestCSendUIShowQueryAndSendLL ); |
|
1643 // Print to log file |
|
1644 iLog->Log( KTestCSendUIShowQueryAndSendLL ); |
|
1645 |
|
1646 TSendingCapabilities capabilities(0, 0, TSendingCapabilities::ESupportsEditor ); |
|
1647 |
|
1648 _LIT( KShowQueryAndSendL, "Calling CSendUI ShowQueryAndSendL ..." ); |
|
1649 iLog->Log( KShowQueryAndSendL ); |
|
1650 //Calling CSendUI ShowQueryAndSendL |
|
1651 TRAPD(err, iSendUi->ShowQueryAndSendL( |
|
1652 NULL, |
|
1653 capabilities, |
|
1654 NULL, // services to dim |
|
1655 KNullUid, |
|
1656 ETrue, // editor embedded |
|
1657 KWrite )); |
|
1658 |
|
1659 if(err == KErrNone) |
|
1660 { |
|
1661 _LIT( KSendUIErr, "CSendUI ShowQueryAndSendL is succesfully called" ); |
|
1662 iLog->Log( KSendUIErr ); |
|
1663 return KErrNone; |
|
1664 } |
|
1665 else |
|
1666 { |
|
1667 _LIT( KSendUIErr, "CSendUI ShowQueryAndSendL has Left" ); |
|
1668 iLog->Log( KSendUIErr ); |
|
1669 return KErrGeneral; |
|
1670 } |
|
1671 } |
|
1672 |
|
1673 // ----------------------------------------------------------------------------- |
|
1674 // CSendUIAPITest::TestCSendUIShowSendQueryLL |
|
1675 // Test method for CSendUI ShowSendQueryL |
|
1676 // (other items were commented in a header). |
|
1677 // ----------------------------------------------------------------------------- |
|
1678 // |
|
1679 |
|
1680 TInt CSendUIAPITest::TestCSendUIShowSendQueryLL( CStifItemParser& /*aItem*/ ) |
|
1681 { |
|
1682 // Print to UI |
|
1683 _LIT( KSendUIAPITest, "SendUIAPITest CSendUI" ); |
|
1684 _LIT( KTestCSendUIShowSendQueryLL, "In TestCSendUIShowSendQueryLL" ); |
|
1685 TestModuleIf().Printf( 0, KSendUIAPITest, KTestCSendUIShowSendQueryLL ); |
|
1686 // Print to log file |
|
1687 iLog->Log( KTestCSendUIShowSendQueryLL ); |
|
1688 |
|
1689 TSendingCapabilities capabilities(0, 0, TSendingCapabilities::ESupportsEditor ); |
|
1690 TUid serviceId; |
|
1691 |
|
1692 _LIT( KShowSendQueryL, "Calling CSendUI ShowSendQueryL ..." ); |
|
1693 iLog->Log( KShowSendQueryL ); |
|
1694 //Calling CSendUI ShowSendQueryL |
|
1695 TRAPD(err, serviceId = iSendUi->ShowSendQueryL( |
|
1696 NULL, |
|
1697 capabilities, |
|
1698 NULL, // services to dim |
|
1699 KTextOpenEditor )); |
|
1700 |
|
1701 if(err == KErrNone) |
|
1702 { |
|
1703 _LIT( KretShowSendQueryL, "ShowSendQueryL called successfully" ); |
|
1704 iLog->Log( KretShowSendQueryL ); |
|
1705 if (serviceId != TUid::Null()) // not canceled |
|
1706 { |
|
1707 _LIT( KShowSendQueryL, "ShowSendQueryL returns a valid ServiceID" ); |
|
1708 iLog->Log( KShowSendQueryL ); |
|
1709 //Create and Send the Message |
|
1710 _LIT( KCreateAndSendMessageL, "Calling CSendUI CreateAndSendMessageL" ); |
|
1711 iLog->Log( KCreateAndSendMessageL ); |
|
1712 TRAPD(err, iSendUi->CreateAndSendMessageL( |
|
1713 serviceId, |
|
1714 NULL, |
|
1715 KNullUid, |
|
1716 0)); |
|
1717 if(err == KErrNone) |
|
1718 { |
|
1719 iLog->Log(_L("CSendUI CreateAndSendMessageL call is successful")); |
|
1720 return KErrNone; |
|
1721 } |
|
1722 else |
|
1723 { |
|
1724 iLog->Log(_L("CSendUI CreateAndSendMessageL call is unsuccessful")); |
|
1725 return KErrGeneral; |
|
1726 } |
|
1727 } |
|
1728 else |
|
1729 { |
|
1730 _LIT( KShowSendQueryL, "ShowSendQueryL returns a NULL ServiceID because user has selected Cancel" ); |
|
1731 iLog->Log( KShowSendQueryL ); |
|
1732 return KErrNone; |
|
1733 } |
|
1734 } |
|
1735 else |
|
1736 { |
|
1737 _LIT( KSendUIErr, "CSendUI ShowSendQueryL has Left" ); |
|
1738 iLog->Log( KSendUIErr ); |
|
1739 return KErrGeneral; |
|
1740 } |
|
1741 } |
|
1742 |
|
1743 // ----------------------------------------------------------------------------- |
|
1744 // CSendUIAPITest::TestCSendUIValidateServiceLL |
|
1745 // Test method for CSendUI SendUIValidateServiceL |
|
1746 // (other items were commented in a header). |
|
1747 // ----------------------------------------------------------------------------- |
|
1748 // |
|
1749 |
|
1750 TInt CSendUIAPITest::TestCSendUIValidateServiceLL( CStifItemParser& /*aItem*/ ) |
|
1751 { |
|
1752 // Print to UI |
|
1753 _LIT( KSendUIAPITest, "SendUIAPITest CSendUI" ); |
|
1754 _LIT( KTestCSendUIValidateServiceLL, "In TestCSendUIValidateServiceLL" ); |
|
1755 TestModuleIf().Printf( 0, KSendUIAPITest, KTestCSendUIValidateServiceLL ); |
|
1756 // Print to log file |
|
1757 iLog->Log( KTestCSendUIValidateServiceLL ); |
|
1758 |
|
1759 TSendingCapabilities capabilities(0, 0, TSendingCapabilities::EAllServices ); |
|
1760 |
|
1761 _LIT( KValidateServiceL, "Calling CSendUI ValidateServiceL ..." ); |
|
1762 iLog->Log( KValidateServiceL ); |
|
1763 |
|
1764 TInt ret = EFalse; |
|
1765 //Calling CSendUI ValidateServiceL |
|
1766 // This only tests that these Mtm return something and they do exist |
|
1767 #ifdef __SENDUI_MMS_UPLOAD |
|
1768 // test direct and indirect uploads. |
|
1769 TRAPD( err, ret = iSendUi->ValidateServiceL(KMmsDirectUpload,capabilities)); |
|
1770 if(ret != EFalse) |
|
1771 { |
|
1772 iLog->Log(_L("SendUi has MmsDirectUpload service available")); |
|
1773 } |
|
1774 |
|
1775 TRAP( err, ret = iSendUi->ValidateServiceL(KMmsIndirectUpload,capabilities)); |
|
1776 if(ret != EFalse) |
|
1777 { |
|
1778 iLog->Log(_L("SendUi has MmsIndirectUpload service available")); |
|
1779 } |
|
1780 |
|
1781 if(err) |
|
1782 { |
|
1783 iLog->Log( _L("CSendUI ValidateServiceL has Left with error id %d"),err ); |
|
1784 return KErrGeneral; |
|
1785 } |
|
1786 else |
|
1787 { |
|
1788 _LIT( KSendUIErr, "CSendUI ValidateServiceL call successfull" ); |
|
1789 iLog->Log( KSendUIErr ); |
|
1790 return KErrNone; |
|
1791 } |
|
1792 #endif |
|
1793 |
|
1794 TRAPD( err, ret = iSendUi->ValidateServiceL(KSenduiMtmMmsUid,capabilities)); |
|
1795 if(ret != EFalse) |
|
1796 { |
|
1797 iLog->Log(_L("SendUi has Mms service available")); |
|
1798 } |
|
1799 |
|
1800 TRAP( err, ret = iSendUi->ValidateServiceL(KSenduiMtmSmsUid,capabilities)); |
|
1801 if(ret != EFalse) |
|
1802 { |
|
1803 iLog->Log(_L("SendUi has Sms service available")); |
|
1804 } |
|
1805 |
|
1806 TRAP( err, ret = iSendUi->ValidateServiceL(KSenduiMtmPostcardUid,capabilities)); |
|
1807 if(ret != EFalse) |
|
1808 { |
|
1809 iLog->Log(_L("SendUi has Postcard service available")); |
|
1810 } |
|
1811 |
|
1812 TRAP( err, ret = iSendUi->ValidateServiceL(KSenduiMtmSmtpUid,capabilities)); |
|
1813 if(ret != EFalse) |
|
1814 { |
|
1815 iLog->Log(_L("SendUi has Smtp service available")); |
|
1816 } |
|
1817 |
|
1818 #ifndef __WINSCW__ |
|
1819 TRAPD( errBt, ret = iSendUi->ValidateServiceL(KSenduiMtmBtUid,capabilities)); |
|
1820 if(ret != EFalse) |
|
1821 { |
|
1822 iLog->Log(_L("SendUi has BlueTooth service available")); |
|
1823 } |
|
1824 if(errBt) |
|
1825 { |
|
1826 iLog->Log( _L("CSendUI ValidateServiceL for Bluetooth has Left with error id %d"),err ); |
|
1827 } |
|
1828 else |
|
1829 { |
|
1830 _LIT( KSendUIErr, "CSendUI ValidateServiceL call successfull" ); |
|
1831 iLog->Log( KSendUIErr ); |
|
1832 } |
|
1833 #endif |
|
1834 |
|
1835 TRAP( err, ret = iSendUi->ValidateServiceL(KSenduiMtmIrUid,capabilities)); |
|
1836 if(ret != EFalse) |
|
1837 { |
|
1838 iLog->Log(_L("SendUi has Infrared service available")); |
|
1839 } |
|
1840 if(err) |
|
1841 { |
|
1842 iLog->Log( _L("CSendUI ValidateServiceL for has Left with error id %d"),err ); |
|
1843 return KErrGeneral; |
|
1844 } |
|
1845 else |
|
1846 { |
|
1847 _LIT( KSendUIErr, "CSendUI ValidateServiceL call successfull" ); |
|
1848 iLog->Log( KSendUIErr ); |
|
1849 return KErrNone; |
|
1850 } |
|
1851 } |
|
1852 |
|
1853 // ----------------------------------------------------------------------------- |
|
1854 // CSendUIAPITest::TestCSendUIServiceCapabilitiesLL |
|
1855 // Test method for CSendUI ValidateServiceL |
|
1856 // (other items were commented in a header). |
|
1857 // ----------------------------------------------------------------------------- |
|
1858 // |
|
1859 |
|
1860 TInt CSendUIAPITest::TestCSendUIServiceCapabilitiesLL( CStifItemParser& /*aItem*/ ) |
|
1861 { |
|
1862 // Print to UI |
|
1863 _LIT( KSendUIAPITest, "SendUIAPITest CSendUI" ); |
|
1864 _LIT( KTestCSendUIServiceCapabilitiesLL, "In TestCSendUIServiceCapabilitiesLL" ); |
|
1865 TestModuleIf().Printf( 0, KSendUIAPITest, KTestCSendUIServiceCapabilitiesLL ); |
|
1866 // Print to log file |
|
1867 iLog->Log( KTestCSendUIServiceCapabilitiesLL ); |
|
1868 |
|
1869 TSendingCapabilities capabilities(0, 0, TSendingCapabilities::ESupportsEditor ); |
|
1870 |
|
1871 _LIT( KServiceCapabilitiesL, "Calling CSendUI ServiceCapabilitiesL ..." ); |
|
1872 iLog->Log( KServiceCapabilitiesL ); |
|
1873 TInt ret = KErrNone; |
|
1874 //Calling CSendUI ServiceCapabilitiesL |
|
1875 TRAPD( err, ret = iSendUi->ServiceCapabilitiesL( KSenduiMtmSmsUid, capabilities) ); |
|
1876 if(err == KErrNone) |
|
1877 { |
|
1878 if(ret != KErrNone) |
|
1879 { |
|
1880 iLog->Log(_L("CSendUI ServiceCapabilitiesL call unsuccessfull")); |
|
1881 return ret; |
|
1882 } |
|
1883 else |
|
1884 { |
|
1885 iLog->Log(_L("CSendUI ServiceCapabilitiesL call successfull")); |
|
1886 return KErrNone; |
|
1887 } |
|
1888 } |
|
1889 else |
|
1890 { |
|
1891 _LIT( KSendUIErr, "CSendUI ServiceCapabilitiesL has Left" ); |
|
1892 iLog->Log( KSendUIErr ); |
|
1893 return KErrGeneral; |
|
1894 } |
|
1895 } |
|
1896 |
|
1897 // ----------------------------------------------------------------------------- |
|
1898 // CSendUIAPITest::TestCSendUIAvailableServicesLL |
|
1899 // Test method for CSendUI AvailableServicesL |
|
1900 // (other items were commented in a header). |
|
1901 // ----------------------------------------------------------------------------- |
|
1902 // |
|
1903 |
|
1904 TInt CSendUIAPITest::TestCSendUIAvailableServicesLL( CStifItemParser& /*aItem*/ ) |
|
1905 { |
|
1906 // Print to UI |
|
1907 _LIT( KSendUIAPITest, "SendUIAPITest CSendUI" ); |
|
1908 _LIT( KTestCSendUIAvailableServicesLL, "In TestCSendUIAvailableServicesLL" ); |
|
1909 TestModuleIf().Printf( 0, KSendUIAPITest, KTestCSendUIAvailableServicesLL ); |
|
1910 // Print to log file |
|
1911 iLog->Log( KTestCSendUIAvailableServicesLL ); |
|
1912 |
|
1913 RPointerArray<CSendingServiceInfo> services; |
|
1914 |
|
1915 _LIT( KAvailableServicesL, "Calling CSendUI AvailableServicesL ..." ); |
|
1916 iLog->Log( KAvailableServicesL ); |
|
1917 //Calling CSendUI AvailableServicesL |
|
1918 TRAPD(err , iSendUi->AvailableServicesL(services,KDrmLinkSender)); |
|
1919 if(err == KErrNone) |
|
1920 { |
|
1921 if(services.Count() > 0) |
|
1922 { |
|
1923 _LIT( KSendUIServiceCnt, "CSendUI AvailableServicesL count is non zero" ); |
|
1924 iLog->Log( KSendUIServiceCnt ); |
|
1925 } |
|
1926 _LIT( KSendUIErr, "CSendUI AvailableServicesL call successfull" ); |
|
1927 iLog->Log( KSendUIErr ); |
|
1928 |
|
1929 //Calling CSendUI TechnologyType |
|
1930 TUid techTypeUid = iSendUi->TechnologyType( KDrmLinkSender ); |
|
1931 if(techTypeUid != TUid::Uid(0) ) |
|
1932 { |
|
1933 iLog->Log(_L("CSendUI TechnologyType call successful")); |
|
1934 } |
|
1935 else |
|
1936 { |
|
1937 iLog->Log(_L("CSendUI TechnologyType returns NULL ie. DrmLinkSend service doesn't exist")); |
|
1938 } |
|
1939 return KErrNone; |
|
1940 } |
|
1941 else |
|
1942 { |
|
1943 _LIT( KSendUIErr, "CSendUI AvailableServicesL has left " ); |
|
1944 iLog->Log( KSendUIErr ); |
|
1945 return KErrGeneral; |
|
1946 } |
|
1947 } |
|
1948 |
|
1949 // ----------------------------------------------------------------------------- |
|
1950 // CSendUIAPITest::TestCSendUIAddTypedMenuItemLL |
|
1951 // Test method for CSendUI AddTypedMenuItemL |
|
1952 // (other items were commented in a header). |
|
1953 // ----------------------------------------------------------------------------- |
|
1954 // |
|
1955 |
|
1956 TInt CSendUIAPITest::TestCSendUIAddTypedMenuItemLL( CStifItemParser& /*aItem*/ ) |
|
1957 { |
|
1958 // Print to UI |
|
1959 _LIT( KSendUIAPITest, "SendUIAPITest CSendUI" ); |
|
1960 _LIT( KTestCSendUIAddTypedMenuItemLL, "In TestCSendUIAddTypedMenuItemLL" ); |
|
1961 TestModuleIf().Printf( 0, KSendUIAPITest, KTestCSendUIAddTypedMenuItemLL ); |
|
1962 // Print to log file |
|
1963 iLog->Log( KTestCSendUIAddTypedMenuItemLL ); |
|
1964 |
|
1965 MEikMenuObserver* menuObserver = new(ELeave)FakeObserver(); |
|
1966 |
|
1967 CEikMenuPane* menuPane = new(ELeave)CEikMenuPane(menuObserver); |
|
1968 |
|
1969 _LIT( KAddTypedMenuItemL, "Calling CSendUI AddTypedMenuItemL ..." ); |
|
1970 iLog->Log( KAddTypedMenuItemL ); |
|
1971 //Calling CSendUI AddTypedMenuItemL |
|
1972 TRAPD(err , iSendUi->AddTypedMenuItemL( CSendUi::ESendMenu, *menuPane, 0, 99, KCapabilitiesForAllServices) ); |
|
1973 |
|
1974 if(menuObserver) |
|
1975 delete menuObserver; |
|
1976 if(menuPane) |
|
1977 delete menuPane; |
|
1978 |
|
1979 if(err == KErrNone) |
|
1980 { |
|
1981 _LIT( KSendUIErr, "CSendUI AddTypedMenuItemL call successfull " ); |
|
1982 iLog->Log( KSendUIErr ); |
|
1983 } |
|
1984 else |
|
1985 { |
|
1986 _LIT( KSendUIErr, "CSendUI AddTypedMenuItemL has left " ); |
|
1987 iLog->Log( KSendUIErr ); |
|
1988 return KErrGeneral; |
|
1989 } |
|
1990 |
|
1991 //Also call the depricated CanSendBioMessage API here |
|
1992 TInt result = EFalse; |
|
1993 _LIT( KSendUIBM, "Calling CSendUI CanSendBioMessage ..." ); |
|
1994 iLog->Log( KSendUIBM ); |
|
1995 result = iSendUi->CanSendBioMessage(KSenduiMtmSmsUid); |
|
1996 if(result == EFalse) |
|
1997 return KErrNone; |
|
1998 else |
|
1999 return KErrGeneral; |
|
2000 } |
|
2001 |
|
2002 // ----------------------------------------------------------------------------- |
|
2003 // CSendUIAPITest::TestCSendUIShowTypedQueryAndSendLL |
|
2004 // Test method for CSendUI ShowTypedQueryAndSendL |
|
2005 // (other items were commented in a header). |
|
2006 // ----------------------------------------------------------------------------- |
|
2007 // |
|
2008 |
|
2009 TInt CSendUIAPITest::TestCSendUIShowTypedQueryAndSendLL( CStifItemParser& /*aItem*/ ) |
|
2010 { |
|
2011 // Print to UI |
|
2012 _LIT( KSendUIAPITest, "SendUIAPITest CSendUI" ); |
|
2013 _LIT( KTestCSendUIShowTypedQueryAndSendLL, "In TestCSendUIShowTypedQueryAndSendLL" ); |
|
2014 TestModuleIf().Printf( 0, KSendUIAPITest, KTestCSendUIShowTypedQueryAndSendLL ); |
|
2015 // Print to log file |
|
2016 iLog->Log( KTestCSendUIShowTypedQueryAndSendLL ); |
|
2017 |
|
2018 TSendingCapabilities capabilities(0, 0, TSendingCapabilities::EAllServices); |
|
2019 |
|
2020 TRAPD(err, iSendUi->ShowTypedQueryAndSendL( |
|
2021 CSendUi::EWriteMenu, |
|
2022 NULL, |
|
2023 capabilities, |
|
2024 NULL, // services to dim |
|
2025 KNullUid, |
|
2026 0, |
|
2027 KTextDoNothing ) ); |
|
2028 |
|
2029 if(err == KErrNone) |
|
2030 { |
|
2031 _LIT( KSendUIErr, "CSendUI ShowTypedQueryAndSendL call successfull " ); |
|
2032 iLog->Log( KSendUIErr ); |
|
2033 return KErrNone; |
|
2034 } |
|
2035 else |
|
2036 { |
|
2037 _LIT( KSendUIErr, "CSendUI ShowTypedQueryAndSendL has left " ); |
|
2038 iLog->Log( KSendUIErr ); |
|
2039 return KErrGeneral; |
|
2040 } |
|
2041 } |
|
2042 |
|
2043 // ----------------------------------------------------------------------------- |
|
2044 // CSendUIAPITest::TestCSendUIShowTypedQueryLL |
|
2045 // Test method for CSendUI ShowTypedQueryL |
|
2046 // (other items were commented in a header). |
|
2047 // ----------------------------------------------------------------------------- |
|
2048 // |
|
2049 |
|
2050 TInt CSendUIAPITest::TestCSendUIShowTypedQueryLL( CStifItemParser& /*aItem*/ ) |
|
2051 { |
|
2052 // Print to UI |
|
2053 _LIT( KSendUIAPITest, "SendUIAPITest CSendUI" ); |
|
2054 _LIT( KTestCSendUIShowTypedQueryLL, "In TestCSendUIShowTypedQueryLL" ); |
|
2055 TestModuleIf().Printf( 0, KSendUIAPITest, KTestCSendUIShowTypedQueryLL ); |
|
2056 // Print to log file |
|
2057 iLog->Log( KTestCSendUIShowTypedQueryLL ); |
|
2058 |
|
2059 TSendingCapabilities capabilities(0, 0, TSendingCapabilities::ESupportsEditor ); |
|
2060 TUid serviceId( KNullUid ); |
|
2061 |
|
2062 TRAPD(err, serviceId = iSendUi->ShowTypedQueryL( |
|
2063 CSendUi::EWriteMenu, |
|
2064 NULL, |
|
2065 capabilities, |
|
2066 NULL, // services to dim |
|
2067 KTextSupportsEditor ) ); |
|
2068 |
|
2069 if(err == KErrNone) |
|
2070 { |
|
2071 if (serviceId != TUid::Null()) |
|
2072 { |
|
2073 iLog->Log(_L("CSendUI ShowTypedQueryL call successfull ")); |
|
2074 return KErrNone; |
|
2075 } |
|
2076 else |
|
2077 { |
|
2078 iLog->Log(_L("CSendUI ShowTypedQueryL returns KNullId since user has selected Cancel")); |
|
2079 return KErrNone; |
|
2080 } |
|
2081 } |
|
2082 else |
|
2083 { |
|
2084 _LIT( KSendUIErr, "CSendUI ShowTypedQueryL has left " ); |
|
2085 iLog->Log( KSendUIErr ); |
|
2086 return KErrGeneral; |
|
2087 } |
|
2088 } |
|
2089 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
2090 // None |
|
2091 |
|
2092 // [End of File] - Do not remove |