|
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 "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: MPXMedia and MPXMediaArray testing implementation (mpxmedia.h,mpxmediaarray.h) |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <s32mem.h> |
|
20 #include <mpxmedia.h> |
|
21 #include <mpxmediaarray.h> |
|
22 #include <mpxcollectionpath.h> |
|
23 #include "commontestclass.h" |
|
24 |
|
25 // Begin MPXMedia and MPXMediaArray testing implementation (mpxmedia.h,mpxmediaarray.h)======================== |
|
26 |
|
27 // ----------------------------------------------------------------------------- |
|
28 // CCommonTestClass::MpxMediaNewL() |
|
29 // Returns: Symbian OS errors. |
|
30 // ----------------------------------------------------------------------------- |
|
31 TInt CCommonTestClass::MpxMediaNewL(CStifItemParser& /*aItem*/) |
|
32 { |
|
33 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaNewL testing CMPXMedia::NewL() begin"))); |
|
34 iLog->Log(_L("CCommonTestClass::MpxMediaNewL testing CMPXMedia::NewL() begin")); |
|
35 TInt err=KErrNone; |
|
36 CMPXMedia* media = CMPXMedia::NewL(); |
|
37 CleanupStack::PushL(media); |
|
38 if ( iMPXMediaArray ) |
|
39 { |
|
40 iMPXMediaArray->AppendL(media); |
|
41 CleanupStack::Pop(media); |
|
42 } |
|
43 else |
|
44 { |
|
45 CleanupStack::PopAndDestroy(media); |
|
46 } |
|
47 return err; |
|
48 } |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // CCommonTestClass::MpxMediaNewLSupportedIdsL() |
|
52 // Returns: Symbian OS errors. |
|
53 // ----------------------------------------------------------------------------- |
|
54 TInt CCommonTestClass::MpxMediaNewLSupportedIdsL(CStifItemParser& aItem) |
|
55 { |
|
56 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaNewLSupportedIdsL testing CMPXMedia::NewL() begin"))); |
|
57 iLog->Log(_L("CCommonTestClass::MpxMediaNewLSupportedIdsL testing CMPXMedia::NewL() begin")); |
|
58 TInt err=KErrNone; |
|
59 RArray<TInt> supportedIds; |
|
60 TInt id; |
|
61 |
|
62 CleanupClosePushL(supportedIds); |
|
63 // read in parameters |
|
64 while ( aItem.GetNextInt(id) == KErrNone ) |
|
65 { |
|
66 supportedIds.AppendL(id); |
|
67 } |
|
68 |
|
69 CMPXMedia* media = CMPXMedia::NewL(supportedIds.Array()); |
|
70 CleanupStack::PushL(media); |
|
71 if ( iMPXMediaArray ) |
|
72 { |
|
73 iMPXMediaArray->AppendL(media); |
|
74 CleanupStack::Pop(media); |
|
75 } |
|
76 else |
|
77 { |
|
78 CleanupStack::PopAndDestroy(media); |
|
79 } |
|
80 CleanupStack::PopAndDestroy(&supportedIds); |
|
81 return err; |
|
82 } |
|
83 |
|
84 // ----------------------------------------------------------------------------- |
|
85 // CCommonTestClass::MpxMediaNewLMediaL() |
|
86 // Returns: Symbian OS errors. |
|
87 // ----------------------------------------------------------------------------- |
|
88 TInt CCommonTestClass::MpxMediaNewLMediaL(CStifItemParser& aItem) |
|
89 { |
|
90 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaNewLMediaL testing CMPXMedia::NewL() begin"))); |
|
91 iLog->Log(_L("CCommonTestClass::MpxMediaNewLMediaL testing CMPXMedia::NewL() begin")); |
|
92 TInt err=KErrNone; |
|
93 TUint index; |
|
94 |
|
95 // read in parameters |
|
96 if ( aItem.GetNextInt(index) ) |
|
97 { |
|
98 iLog->Log(_L("Missing Parameter: index.")); |
|
99 return KErrBadTestParameter; |
|
100 } |
|
101 if ( !iMPXMediaArray ) |
|
102 { |
|
103 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
104 return KErrBadTestParameter; |
|
105 } |
|
106 if ( index >= iMPXMediaArray->Count() ) |
|
107 { |
|
108 iLog->Log(_L("Bad Parameter: index out of range.")); |
|
109 return KErrBadTestParameter; |
|
110 } |
|
111 |
|
112 CMPXMedia* media = CMPXMedia::NewL(*(*iMPXMediaArray)[index]); |
|
113 CleanupStack::PushL(media); |
|
114 iMPXMediaArray->AppendL(media); |
|
115 CleanupStack::Pop(media); |
|
116 return err; |
|
117 } |
|
118 |
|
119 // ----------------------------------------------------------------------------- |
|
120 // CCommonTestClass::MpxMediaNewLDataHandleL() |
|
121 // Returns: Symbian OS errors. |
|
122 // ----------------------------------------------------------------------------- |
|
123 TInt CCommonTestClass::MpxMediaNewLDataHandleL(CStifItemParser& aItem) |
|
124 { |
|
125 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaNewLDataHandleL testing CMPXMedia::NewL() begin"))); |
|
126 iLog->Log(_L("CCommonTestClass::MpxMediaNewLDataHandleL testing CMPXMedia::NewL() begin")); |
|
127 TInt err=KErrNone; |
|
128 TUint index; |
|
129 |
|
130 // read in parameters |
|
131 if ( aItem.GetNextInt(index) ) |
|
132 { |
|
133 iLog->Log(_L("Missing Parameter: index.")); |
|
134 return KErrBadTestParameter; |
|
135 } |
|
136 if ( !iMPXMediaArray ) |
|
137 { |
|
138 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
139 return KErrBadTestParameter; |
|
140 } |
|
141 if ( index >= iMPXMediaArray->Count() ) |
|
142 { |
|
143 iLog->Log(_L("Bad Parameter: index out of range.")); |
|
144 return KErrBadTestParameter; |
|
145 } |
|
146 |
|
147 CMPXMedia* media = CMPXMedia::NewL((*iMPXMediaArray)[index]->Data()); |
|
148 CleanupStack::PushL(media); |
|
149 iMPXMediaArray->AppendL(media); |
|
150 CleanupStack::Pop(media); |
|
151 return err; |
|
152 } |
|
153 |
|
154 // ----------------------------------------------------------------------------- |
|
155 // CCommonTestClass::MpxMediaNewLStreamL() |
|
156 // Returns: Symbian OS errors. |
|
157 // ----------------------------------------------------------------------------- |
|
158 TInt CCommonTestClass::MpxMediaNewLStreamL(CStifItemParser& aItem) |
|
159 { |
|
160 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaNewLStreamL testing CMPXMedia::NewL() begin"))); |
|
161 iLog->Log(_L("CCommonTestClass::MpxMediaNewLStreamL testing CMPXMedia::NewL() begin")); |
|
162 TInt err=KErrNone; |
|
163 TUint index; |
|
164 |
|
165 // read in parameters |
|
166 if ( aItem.GetNextInt(index) ) |
|
167 { |
|
168 iLog->Log(_L("Missing Parameter: index.")); |
|
169 return KErrBadTestParameter; |
|
170 } |
|
171 if ( !iMPXMediaArray ) |
|
172 { |
|
173 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
174 return KErrBadTestParameter; |
|
175 } |
|
176 if ( index >= iMPXMediaArray->Count() ) |
|
177 { |
|
178 iLog->Log(_L("Bad Parameter: index out of range.")); |
|
179 return KErrBadTestParameter; |
|
180 } |
|
181 |
|
182 CBufBase* buffer = CBufFlat::NewL( 100 ); |
|
183 CleanupStack::PushL( buffer ); |
|
184 RBufWriteStream writeStream( *buffer ); |
|
185 CleanupClosePushL( writeStream ); |
|
186 (*iMPXMediaArray)[index]->ExternalizeL( writeStream ); |
|
187 writeStream.CommitL(); |
|
188 buffer->Compress(); |
|
189 CleanupStack::PopAndDestroy( &writeStream ); |
|
190 |
|
191 RBufReadStream readStream( *buffer ); |
|
192 CleanupClosePushL( readStream ); |
|
193 CMPXMedia* media = CMPXMedia::NewL(readStream); |
|
194 CleanupStack::PushL(media); |
|
195 iMPXMediaArray->AppendL(media); |
|
196 CleanupStack::Pop(media); |
|
197 CleanupStack::PopAndDestroy( &readStream ); |
|
198 CleanupStack::PopAndDestroy( buffer ); |
|
199 return err; |
|
200 } |
|
201 |
|
202 // ----------------------------------------------------------------------------- |
|
203 // CCommonTestClass::MpxMediaOperatorAssignment() |
|
204 // Returns: Symbian OS errors. |
|
205 // ----------------------------------------------------------------------------- |
|
206 TInt CCommonTestClass::MpxMediaOperatorAssignment(CStifItemParser& aItem) |
|
207 { |
|
208 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaOperatorAssignment testing CMPXMedia::operator=() begin"))); |
|
209 iLog->Log(_L("CCommonTestClass::MpxMediaOperatorAssignment testing CMPXMedia::operator=() begin")); |
|
210 TInt err=KErrNone; |
|
211 TUint index; |
|
212 |
|
213 // read in parameters |
|
214 if ( aItem.GetNextInt(index) ) |
|
215 { |
|
216 iLog->Log(_L("Missing Parameter: index.")); |
|
217 return KErrBadTestParameter; |
|
218 } |
|
219 if ( !iMPXMediaArray ) |
|
220 { |
|
221 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
222 return KErrBadTestParameter; |
|
223 } |
|
224 if ( index >= iMPXMediaArray->Count() ) |
|
225 { |
|
226 iLog->Log(_L("Bad Parameter: index out of range.")); |
|
227 return KErrBadTestParameter; |
|
228 } |
|
229 |
|
230 CMPXMedia* media; |
|
231 TRAP(err , media= CMPXMedia::NewL()); |
|
232 CleanupStack::PushL(media); |
|
233 media->operator =(*(*iMPXMediaArray)[index]); |
|
234 TRAP(err , iMPXMediaArray->AppendL(media)); |
|
235 CleanupStack::Pop(media); |
|
236 return err; |
|
237 } |
|
238 |
|
239 // ----------------------------------------------------------------------------- |
|
240 // CCommonTestClass::MpxMediaSupportedIds() |
|
241 // Returns: Symbian OS errors. |
|
242 // ----------------------------------------------------------------------------- |
|
243 TInt CCommonTestClass::MpxMediaSupportedIds(CStifItemParser& aItem) |
|
244 { |
|
245 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaSupportedIds testing CMPXMedia::SupportedIds() begin"))); |
|
246 iLog->Log(_L("CCommonTestClass::MpxMediaSupportedIds testing CMPXMedia::SupportedIds() begin")); |
|
247 TInt err=KErrNone; |
|
248 TUint index; |
|
249 RArray<TInt> expectedSupportedIds; |
|
250 TInt id; |
|
251 |
|
252 // read in parameters |
|
253 if ( aItem.GetNextInt(index) ) |
|
254 { |
|
255 iLog->Log(_L("Missing Parameter: index.")); |
|
256 return KErrBadTestParameter; |
|
257 } |
|
258 if ( !iMPXMediaArray ) |
|
259 { |
|
260 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
261 return KErrBadTestParameter; |
|
262 } |
|
263 if ( index >= iMPXMediaArray->Count() ) |
|
264 { |
|
265 iLog->Log(_L("Bad Parameter: index out of range.")); |
|
266 return KErrBadTestParameter; |
|
267 } |
|
268 |
|
269 while ( aItem.GetNextInt(id) == KErrNone ) |
|
270 { |
|
271 expectedSupportedIds.Append(id); |
|
272 } |
|
273 TArray<TInt> supportedIds = (*iMPXMediaArray)[index]->SupportedIds(); |
|
274 |
|
275 // verify supported IDS |
|
276 if ( supportedIds.Count() == expectedSupportedIds.Count() ) |
|
277 { |
|
278 for (TInt i=0; i<supportedIds.Count(); i++) |
|
279 { |
|
280 if ( expectedSupportedIds.Find(supportedIds[i]) == KErrNotFound ) |
|
281 { |
|
282 iLog->Log(_L("Verification Failed: ContentID not Found = %d."), supportedIds[i]); |
|
283 err = KErrUnexpectedValue; |
|
284 } |
|
285 } |
|
286 } |
|
287 else |
|
288 { |
|
289 iLog->Log(_L("Verification Failed: count=%d, expected count=%d."), supportedIds.Count(), expectedSupportedIds.Count()); |
|
290 err = KErrUnexpectedValue; |
|
291 } |
|
292 |
|
293 return err; |
|
294 } |
|
295 |
|
296 // ----------------------------------------------------------------------------- |
|
297 // CCommonTestClass::MpxMediaAttributes() |
|
298 // Returns: Symbian OS errors. |
|
299 // ----------------------------------------------------------------------------- |
|
300 TInt CCommonTestClass::MpxMediaAttributes(CStifItemParser& aItem) |
|
301 { |
|
302 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaAttributes testing CMPXMedia::Attributes() begin"))); |
|
303 iLog->Log(_L("CCommonTestClass::MpxMediaAttributes testing CMPXMedia::Attributes() begin")); |
|
304 TInt err=KErrNone; |
|
305 TUint mediaIndex; |
|
306 TUint attIndex; |
|
307 |
|
308 // read in parameters |
|
309 if ( aItem.GetNextInt(mediaIndex) ) |
|
310 { |
|
311 iLog->Log(_L("Missing Parameter: Media index.")); |
|
312 return KErrBadTestParameter; |
|
313 } |
|
314 if ( !iMPXMediaArray ) |
|
315 { |
|
316 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
317 return KErrBadTestParameter; |
|
318 } |
|
319 if ( mediaIndex >= iMPXMediaArray->Count() ) |
|
320 { |
|
321 iLog->Log(_L("Bad Parameter: Media index out of range.")); |
|
322 return KErrBadTestParameter; |
|
323 } |
|
324 if ( aItem.GetNextInt(attIndex) ) |
|
325 { |
|
326 iLog->Log(_L("Missing Parameter: Attribute index.")); |
|
327 return KErrBadTestParameter; |
|
328 } |
|
329 if ( attIndex >= iMPXAttArray.Count() ) |
|
330 { |
|
331 iLog->Log(_L("Bad Parameter: Attribute index out of range.")); |
|
332 return KErrBadTestParameter; |
|
333 } |
|
334 |
|
335 TArray<TMPXAttribute> attributes = (*iMPXMediaArray)[mediaIndex]->Attributes(); |
|
336 // verify attributes |
|
337 TBool found = EFalse; |
|
338 for (TInt i=0; i<attributes.Count(); i++) |
|
339 { |
|
340 if ( iMPXAttArray[attIndex] == attributes[i] ) |
|
341 { |
|
342 found = ETrue; |
|
343 } |
|
344 } |
|
345 if ( !found ) |
|
346 { |
|
347 iLog->Log(_L("Verification Failed: Attribute not found - contentID=%d, attID=%d."), |
|
348 iMPXAttArray[attIndex].ContentId(), iMPXAttArray[attIndex].AttributeId()); |
|
349 err = KErrUnexpectedValue; |
|
350 } |
|
351 return err; |
|
352 } |
|
353 |
|
354 // ----------------------------------------------------------------------------- |
|
355 // CCommonTestClass::MpxMediaSetTObjectValueL() |
|
356 // Returns: Symbian OS errors. |
|
357 // ----------------------------------------------------------------------------- |
|
358 TInt CCommonTestClass::MpxMediaSetTObjectValueL(CStifItemParser& aItem) |
|
359 { |
|
360 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaSetTObjectValueL testing CMPXMedia::SetTObjectValueL() begin"))); |
|
361 iLog->Log(_L("CCommonTestClass::MpxMediaSetTObjectValueL testing CMPXMedia::SetTObjectValueL() begin")); |
|
362 TInt err=KErrNone; |
|
363 TUint mediaIndex; |
|
364 TUint attIndex; |
|
365 TInt attValue; |
|
366 |
|
367 // read in parameters |
|
368 if ( aItem.GetNextInt(mediaIndex) ) |
|
369 { |
|
370 iLog->Log(_L("Missing Parameter: Media index.")); |
|
371 return KErrBadTestParameter; |
|
372 } |
|
373 if ( !iMPXMediaArray ) |
|
374 { |
|
375 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
376 return KErrBadTestParameter; |
|
377 } |
|
378 if ( mediaIndex >= iMPXMediaArray->Count() ) |
|
379 { |
|
380 iLog->Log(_L("Bad Parameter: Media index out of range.")); |
|
381 return KErrBadTestParameter; |
|
382 } |
|
383 if ( aItem.GetNextInt(attIndex) ) |
|
384 { |
|
385 iLog->Log(_L("Missing Parameter: Attribute index.")); |
|
386 return KErrBadTestParameter; |
|
387 } |
|
388 if ( attIndex >= iMPXAttArray.Count() ) |
|
389 { |
|
390 iLog->Log(_L("Bad Parameter: Attribute index out of range.")); |
|
391 return KErrBadTestParameter; |
|
392 } |
|
393 if ( aItem.GetNextInt(attValue) ) |
|
394 { |
|
395 iLog->Log(_L("Missing Parameter: Attribute value.")); |
|
396 return KErrBadTestParameter; |
|
397 } |
|
398 |
|
399 // set attribue |
|
400 (*iMPXMediaArray)[mediaIndex]->SetTObjectValueL(iMPXAttArray[attIndex], attValue); |
|
401 return err; |
|
402 } |
|
403 |
|
404 // ----------------------------------------------------------------------------- |
|
405 // CCommonTestClass::MpxMediaSetCObjectValueL() |
|
406 // Returns: Symbian OS errors. |
|
407 // ----------------------------------------------------------------------------- |
|
408 TInt CCommonTestClass::MpxMediaSetCObjectValueL(CStifItemParser& aItem) |
|
409 { |
|
410 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaSetCObjectValueL testing CMPXMedia::SetCObjectValueL() begin"))); |
|
411 iLog->Log(_L("CCommonTestClass::MpxMediaSetCObjectValueL testing CMPXMedia::SetCObjectValueL() begin")); |
|
412 TInt err=KErrNone; |
|
413 TUint mediaIndex; |
|
414 TUint attIndex; |
|
415 TPtrC className; |
|
416 |
|
417 // read in parameters |
|
418 if ( aItem.GetNextInt(mediaIndex) ) |
|
419 { |
|
420 iLog->Log(_L("Missing Parameter: Media index.")); |
|
421 return KErrBadTestParameter; |
|
422 } |
|
423 if ( !iMPXMediaArray ) |
|
424 { |
|
425 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
426 return KErrBadTestParameter; |
|
427 } |
|
428 if ( mediaIndex >= iMPXMediaArray->Count() ) |
|
429 { |
|
430 iLog->Log(_L("Bad Parameter: Media index out of range.")); |
|
431 return KErrBadTestParameter; |
|
432 } |
|
433 if ( aItem.GetNextInt(attIndex) ) |
|
434 { |
|
435 iLog->Log(_L("Missing Parameter: Attribute index.")); |
|
436 return KErrBadTestParameter; |
|
437 } |
|
438 if ( attIndex >= iMPXAttArray.Count() ) |
|
439 { |
|
440 iLog->Log(_L("Bad Parameter: Attribute index out of range.")); |
|
441 return KErrBadTestParameter; |
|
442 } |
|
443 if ( aItem.GetNextString(className) ) |
|
444 { |
|
445 iLog->Log(_L("Missing Parameter: Class name.")); |
|
446 return KErrBadTestParameter; |
|
447 } |
|
448 |
|
449 // set class object |
|
450 if ( className == _L("CMPXMedia") ) |
|
451 { |
|
452 CMPXMedia* media = CMPXMedia::NewL(); |
|
453 CleanupStack::PushL(media); |
|
454 (*iMPXMediaArray)[mediaIndex]->SetCObjectValueL(iMPXAttArray[attIndex], media); |
|
455 CleanupStack::PopAndDestroy(media); |
|
456 } |
|
457 else if ( className == _L("CMPXMediaArray") ) |
|
458 { |
|
459 CMPXMediaArray* media = CMPXMediaArray::NewL(); |
|
460 CleanupStack::PushL(media); |
|
461 (*iMPXMediaArray)[mediaIndex]->SetCObjectValueL(iMPXAttArray[attIndex], media); |
|
462 CleanupStack::PopAndDestroy(media); |
|
463 } |
|
464 else if ( className == _L("CMPXCollectionPath") ) |
|
465 { |
|
466 CMPXCollectionPath* media = CMPXCollectionPath::NewL(); |
|
467 CleanupStack::PushL(media); |
|
468 (*iMPXMediaArray)[mediaIndex]->SetCObjectValueL(iMPXAttArray[attIndex], media); |
|
469 CleanupStack::PopAndDestroy(media); |
|
470 } |
|
471 else |
|
472 { |
|
473 iLog->Log(_L("Bad Parameter: Invalid class name.")); |
|
474 return KErrBadTestParameter; |
|
475 } |
|
476 return err; |
|
477 } |
|
478 |
|
479 // ----------------------------------------------------------------------------- |
|
480 // CCommonTestClass::MpxMediaSetNoNewLCObjectL() |
|
481 // Returns: Symbian OS errors. |
|
482 // ----------------------------------------------------------------------------- |
|
483 TInt CCommonTestClass::MpxMediaSetNoNewLCObjectL(CStifItemParser& aItem) |
|
484 { |
|
485 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaSetNoNewLCObjectL testing CMPXMedia::SetNoNewLCObjectL() begin"))); |
|
486 iLog->Log(_L("CCommonTestClass::MpxMediaSetNoNewLCObjectL testing CMPXMedia::SetNoNewLCObjectL() begin")); |
|
487 TInt err=KErrNone; |
|
488 TUint mediaIndex; |
|
489 TUint attIndex; |
|
490 TPtrC className; |
|
491 |
|
492 // read in parameters |
|
493 if ( aItem.GetNextInt(mediaIndex) ) |
|
494 { |
|
495 iLog->Log(_L("Missing Parameter: Media index.")); |
|
496 return KErrBadTestParameter; |
|
497 } |
|
498 if ( !iMPXMediaArray ) |
|
499 { |
|
500 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
501 return KErrBadTestParameter; |
|
502 } |
|
503 if ( mediaIndex >= iMPXMediaArray->Count() ) |
|
504 { |
|
505 iLog->Log(_L("Bad Parameter: Media index out of range.")); |
|
506 return KErrBadTestParameter; |
|
507 } |
|
508 if ( aItem.GetNextInt(attIndex) ) |
|
509 { |
|
510 iLog->Log(_L("Missing Parameter: Attribute index.")); |
|
511 return KErrBadTestParameter; |
|
512 } |
|
513 if ( attIndex >= iMPXAttArray.Count() ) |
|
514 { |
|
515 iLog->Log(_L("Bad Parameter: Attribute index out of range.")); |
|
516 return KErrBadTestParameter; |
|
517 } |
|
518 if ( aItem.GetNextString(className) ) |
|
519 { |
|
520 iLog->Log(_L("Missing Parameter: Class name.")); |
|
521 return KErrBadTestParameter; |
|
522 } |
|
523 |
|
524 // set class object |
|
525 if ( className == _L("CMPXMedia") ) |
|
526 { |
|
527 CMPXMedia* media = CMPXMedia::NewL(); |
|
528 CleanupStack::PushL(media); |
|
529 (*iMPXMediaArray)[mediaIndex]->SetNoNewLCObjectL(iMPXAttArray[attIndex], media); |
|
530 CleanupStack::PopAndDestroy(media); |
|
531 } |
|
532 else if ( className == _L("CMPXMediaArray") ) |
|
533 { |
|
534 CMPXMediaArray* media = CMPXMediaArray::NewL(); |
|
535 CleanupStack::PushL(media); |
|
536 (*iMPXMediaArray)[mediaIndex]->SetNoNewLCObjectL(iMPXAttArray[attIndex], media); |
|
537 CleanupStack::PopAndDestroy(media); |
|
538 } |
|
539 else if ( className == _L("CMPXCollectionPath") ) |
|
540 { |
|
541 CMPXCollectionPath* media = CMPXCollectionPath::NewL(); |
|
542 CleanupStack::PushL(media); |
|
543 (*iMPXMediaArray)[mediaIndex]->SetNoNewLCObjectL(iMPXAttArray[attIndex], media); |
|
544 CleanupStack::PopAndDestroy(media); |
|
545 } |
|
546 else |
|
547 { |
|
548 iLog->Log(_L("Bad Parameter: Invalid class name.")); |
|
549 return KErrBadTestParameter; |
|
550 } |
|
551 return err; |
|
552 } |
|
553 |
|
554 // ----------------------------------------------------------------------------- |
|
555 // CCommonTestClass::MpxMediaSetTextValueL() |
|
556 // Returns: Symbian OS errors. |
|
557 // ----------------------------------------------------------------------------- |
|
558 TInt CCommonTestClass::MpxMediaSetTextValueL(CStifItemParser& aItem) |
|
559 { |
|
560 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaSetTextValueL testing CMPXMedia::SetTextValueL() begin"))); |
|
561 iLog->Log(_L("CCommonTestClass::MpxMediaSetTextValueL testing CMPXMedia::SetTextValueL() begin")); |
|
562 TInt err=KErrNone; |
|
563 TUint mediaIndex; |
|
564 TUint attIndex; |
|
565 TPtrC attValue; |
|
566 |
|
567 // read in parameters |
|
568 if ( aItem.GetNextInt(mediaIndex) ) |
|
569 { |
|
570 iLog->Log(_L("Missing Parameter: Media index.")); |
|
571 return KErrBadTestParameter; |
|
572 } |
|
573 if ( !iMPXMediaArray ) |
|
574 { |
|
575 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
576 return KErrBadTestParameter; |
|
577 } |
|
578 if ( mediaIndex >= iMPXMediaArray->Count() ) |
|
579 { |
|
580 iLog->Log(_L("Bad Parameter: Media index out of range.")); |
|
581 return KErrBadTestParameter; |
|
582 } |
|
583 if ( aItem.GetNextInt(attIndex) ) |
|
584 { |
|
585 iLog->Log(_L("Missing Parameter: Attribute index.")); |
|
586 return KErrBadTestParameter; |
|
587 } |
|
588 if ( attIndex >= iMPXAttArray.Count() ) |
|
589 { |
|
590 iLog->Log(_L("Bad Parameter: Attribute index out of range.")); |
|
591 return KErrBadTestParameter; |
|
592 } |
|
593 if ( aItem.GetNextString(attValue) ) |
|
594 { |
|
595 iLog->Log(_L("Missing Parameter: Attribute value.")); |
|
596 return KErrBadTestParameter; |
|
597 } |
|
598 |
|
599 // set attribue |
|
600 (*iMPXMediaArray)[mediaIndex]->SetTextValueL(iMPXAttArray[attIndex], attValue); |
|
601 return err; |
|
602 } |
|
603 |
|
604 // ----------------------------------------------------------------------------- |
|
605 // CCommonTestClass::MpxMediaIsSupported() |
|
606 // Returns: Symbian OS errors. |
|
607 // ----------------------------------------------------------------------------- |
|
608 TInt CCommonTestClass::MpxMediaIsSupported(CStifItemParser& aItem) |
|
609 { |
|
610 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaIsSupported testing CMPXMedia::IsSupported() begin"))); |
|
611 iLog->Log(_L("CCommonTestClass::MpxMediaIsSupported testing CMPXMedia::IsSupported() begin")); |
|
612 TInt err=KErrNone; |
|
613 TUint mediaIndex; |
|
614 TUint attIndex; |
|
615 TBool expectedResult; |
|
616 |
|
617 // read in parameters |
|
618 if ( aItem.GetNextInt(mediaIndex) ) |
|
619 { |
|
620 iLog->Log(_L("Missing Parameter: Media index.")); |
|
621 return KErrBadTestParameter; |
|
622 } |
|
623 if ( !iMPXMediaArray ) |
|
624 { |
|
625 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
626 return KErrBadTestParameter; |
|
627 } |
|
628 if ( mediaIndex >= iMPXMediaArray->Count() ) |
|
629 { |
|
630 iLog->Log(_L("Bad Parameter: Media index out of range.")); |
|
631 return KErrBadTestParameter; |
|
632 } |
|
633 if ( aItem.GetNextInt(attIndex) ) |
|
634 { |
|
635 iLog->Log(_L("Missing Parameter: Attribute index.")); |
|
636 return KErrBadTestParameter; |
|
637 } |
|
638 if ( attIndex >= iMPXAttArray.Count() ) |
|
639 { |
|
640 iLog->Log(_L("Bad Parameter: Attribute index out of range.")); |
|
641 return KErrBadTestParameter; |
|
642 } |
|
643 if ( aItem.GetNextInt(expectedResult) ) |
|
644 { |
|
645 iLog->Log(_L("Missing Parameter: Expected result.")); |
|
646 return KErrBadTestParameter; |
|
647 } |
|
648 |
|
649 // call IsSupported |
|
650 TBool result = (*iMPXMediaArray)[mediaIndex]->IsSupported(iMPXAttArray[attIndex]); |
|
651 |
|
652 // verification |
|
653 if ( result != expectedResult ) |
|
654 { |
|
655 iLog->Log(_L("Verification Failed: result=%d, expectedResult=%d."), result, expectedResult); |
|
656 err = KErrUnexpectedValue; |
|
657 } |
|
658 return err; |
|
659 } |
|
660 |
|
661 // ----------------------------------------------------------------------------- |
|
662 // CCommonTestClass::MpxMediaCount() |
|
663 // Returns: Symbian OS errors. |
|
664 // ----------------------------------------------------------------------------- |
|
665 TInt CCommonTestClass::MpxMediaCount(CStifItemParser& aItem) |
|
666 { |
|
667 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaCount testing CMPXMedia::Count() begin"))); |
|
668 iLog->Log(_L("CCommonTestClass::MpxMediaCount testing CMPXMedia::Count() begin")); |
|
669 TInt err=KErrNone; |
|
670 TUint mediaIndex; |
|
671 TInt expectedResult; |
|
672 |
|
673 // read in parameters |
|
674 if ( aItem.GetNextInt(mediaIndex) ) |
|
675 { |
|
676 iLog->Log(_L("Missing Parameter: Media index.")); |
|
677 return KErrBadTestParameter; |
|
678 } |
|
679 if ( !iMPXMediaArray ) |
|
680 { |
|
681 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
682 return KErrBadTestParameter; |
|
683 } |
|
684 if ( mediaIndex >= iMPXMediaArray->Count() ) |
|
685 { |
|
686 iLog->Log(_L("Bad Parameter: Media index out of range.")); |
|
687 return KErrBadTestParameter; |
|
688 } |
|
689 if ( aItem.GetNextInt(expectedResult) ) |
|
690 { |
|
691 iLog->Log(_L("Missing Parameter: Expected result.")); |
|
692 return KErrBadTestParameter; |
|
693 } |
|
694 |
|
695 // call Count() |
|
696 TInt result = (*iMPXMediaArray)[mediaIndex]->Count(); |
|
697 |
|
698 // verification |
|
699 if ( result != expectedResult ) |
|
700 { |
|
701 iLog->Log(_L("Verification Failed: result=%d, expectedResult=%d."), result, expectedResult); |
|
702 err = KErrUnexpectedValue; |
|
703 } |
|
704 return err; |
|
705 } |
|
706 |
|
707 // ----------------------------------------------------------------------------- |
|
708 // CCommonTestClass::MpxMediaAttribute() |
|
709 // Returns: Symbian OS errors. |
|
710 // ----------------------------------------------------------------------------- |
|
711 TInt CCommonTestClass::MpxMediaAttribute(CStifItemParser& aItem) |
|
712 { |
|
713 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaAttribute testing CMPXMedia::Attribute() begin"))); |
|
714 iLog->Log(_L("CCommonTestClass::MpxMediaAttribute testing CMPXMedia::Attribute() begin")); |
|
715 TInt err=KErrNone; |
|
716 TUint mediaIndex; |
|
717 TUint attIndex; |
|
718 TInt expectedAttIndex; |
|
719 |
|
720 // read in parameters |
|
721 if ( aItem.GetNextInt(mediaIndex) ) |
|
722 { |
|
723 iLog->Log(_L("Missing Parameter: Media index.")); |
|
724 return KErrBadTestParameter; |
|
725 } |
|
726 if ( !iMPXMediaArray ) |
|
727 { |
|
728 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
729 return KErrBadTestParameter; |
|
730 } |
|
731 if ( mediaIndex >= iMPXMediaArray->Count() ) |
|
732 { |
|
733 iLog->Log(_L("Bad Parameter: Media index out of range.")); |
|
734 return KErrBadTestParameter; |
|
735 } |
|
736 if ( aItem.GetNextInt(attIndex) ) |
|
737 { |
|
738 iLog->Log(_L("Missing Parameter: Index of Attribute in MPXMedia.")); |
|
739 return KErrBadTestParameter; |
|
740 } |
|
741 if ( attIndex >= (*iMPXMediaArray)[mediaIndex]->Count() ) |
|
742 { |
|
743 iLog->Log(_L("Bad Parameter: Index of Attribute out of range.")); |
|
744 return KErrBadTestParameter; |
|
745 } |
|
746 if ( aItem.GetNextInt(expectedAttIndex) ) |
|
747 { |
|
748 iLog->Log(_L("Missing Parameter: Expected Attribute Index.")); |
|
749 return KErrBadTestParameter; |
|
750 } |
|
751 if ( expectedAttIndex >= iMPXAttArray.Count() ) |
|
752 { |
|
753 iLog->Log(_L("Bad Parameter: Expected Attribute index out of range.")); |
|
754 return KErrBadTestParameter; |
|
755 } |
|
756 |
|
757 TMPXAttribute result = (*iMPXMediaArray)[mediaIndex]->Attribute(attIndex); |
|
758 TMPXAttribute expectedResult = iMPXAttArray[expectedAttIndex]; |
|
759 |
|
760 // verification |
|
761 if ( !(result == expectedResult) ) |
|
762 { |
|
763 iLog->Log(_L("Verification Failed: contentID=%d, expectedContentID=%d, attributeID=%d, expectedAttributeID=%d."), |
|
764 result.ContentId(), expectedResult.ContentId(), result.AttributeId(), expectedResult.AttributeId()); |
|
765 err = KErrUnexpectedValue; |
|
766 } |
|
767 return err; |
|
768 } |
|
769 |
|
770 // ----------------------------------------------------------------------------- |
|
771 // CCommonTestClass::MpxMediaAttributesSet() |
|
772 // Returns: Symbian OS errors. |
|
773 // ----------------------------------------------------------------------------- |
|
774 TInt CCommonTestClass::MpxMediaAttributesSet(CStifItemParser& aItem) |
|
775 { |
|
776 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaAttributesSet testing CMPXMedia::AttributesSet() begin"))); |
|
777 iLog->Log(_L("CCommonTestClass::MpxMediaAttributesSet testing CMPXMedia::AttributesSet() begin")); |
|
778 TInt err=KErrNone; |
|
779 TUint mediaIndex; |
|
780 TInt contentID; |
|
781 TUint expectedAttributes; |
|
782 |
|
783 // read in parameters |
|
784 if ( aItem.GetNextInt(mediaIndex) ) |
|
785 { |
|
786 iLog->Log(_L("Missing Parameter: Media index.")); |
|
787 return KErrBadTestParameter; |
|
788 } |
|
789 if ( !iMPXMediaArray ) |
|
790 { |
|
791 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
792 return KErrBadTestParameter; |
|
793 } |
|
794 if ( mediaIndex >= iMPXMediaArray->Count() ) |
|
795 { |
|
796 iLog->Log(_L("Bad Parameter: Media index out of range.")); |
|
797 return KErrBadTestParameter; |
|
798 } |
|
799 if ( aItem.GetNextInt(contentID) ) |
|
800 { |
|
801 iLog->Log(_L("Missing Parameter: ContentID.")); |
|
802 return KErrBadTestParameter; |
|
803 } |
|
804 if ( aItem.GetNextInt(expectedAttributes) ) |
|
805 { |
|
806 iLog->Log(_L("Missing Parameter: Expected Attributes.")); |
|
807 return KErrBadTestParameter; |
|
808 } |
|
809 |
|
810 TUint result = (*iMPXMediaArray)[mediaIndex]->AttributesSet(contentID); |
|
811 // verification |
|
812 if ( result != expectedAttributes ) |
|
813 { |
|
814 iLog->Log(_L("Verification Failed: attributes=%d, expectedAttributes=%d."), result, expectedAttributes); |
|
815 err = KErrUnexpectedValue; |
|
816 } |
|
817 return err; |
|
818 } |
|
819 |
|
820 // ----------------------------------------------------------------------------- |
|
821 // CCommonTestClass::MpxMediaIndex() |
|
822 // Returns: Symbian OS errors. |
|
823 // ----------------------------------------------------------------------------- |
|
824 TInt CCommonTestClass::MpxMediaIndex(CStifItemParser& aItem) |
|
825 { |
|
826 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaIndex testing CMPXMedia::Index() begin"))); |
|
827 iLog->Log(_L("CCommonTestClass::MpxMediaIndex testing CMPXMedia::Index() begin")); |
|
828 TInt err=KErrNone; |
|
829 TUint mediaIndex; |
|
830 TUint attIndex; |
|
831 TInt expectedIndex; |
|
832 |
|
833 // read in parameters |
|
834 if ( aItem.GetNextInt(mediaIndex) ) |
|
835 { |
|
836 iLog->Log(_L("Missing Parameter: Media index.")); |
|
837 return KErrBadTestParameter; |
|
838 } |
|
839 if ( !iMPXMediaArray ) |
|
840 { |
|
841 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
842 return KErrBadTestParameter; |
|
843 } |
|
844 if ( mediaIndex >= iMPXMediaArray->Count() ) |
|
845 { |
|
846 iLog->Log(_L("Bad Parameter: Media index out of range.")); |
|
847 return KErrBadTestParameter; |
|
848 } |
|
849 if ( aItem.GetNextInt(attIndex) ) |
|
850 { |
|
851 iLog->Log(_L("Missing Parameter: Attribute Index.")); |
|
852 return KErrBadTestParameter; |
|
853 } |
|
854 if ( attIndex >= iMPXAttArray.Count() ) |
|
855 { |
|
856 iLog->Log(_L("Bad Parameter: Attribute Index out of range.")); |
|
857 return KErrBadTestParameter; |
|
858 } |
|
859 if ( aItem.GetNextInt(expectedIndex) ) |
|
860 { |
|
861 iLog->Log(_L("Missing Parameter: Expected Index.")); |
|
862 return KErrBadTestParameter; |
|
863 } |
|
864 |
|
865 TInt result = (*iMPXMediaArray)[mediaIndex]->Index(iMPXAttArray[attIndex]); |
|
866 // verification |
|
867 if ( result != expectedIndex ) |
|
868 { |
|
869 iLog->Log(_L("Verification Failed: index=%d, expectedIndex=%d."), result, expectedIndex); |
|
870 err = KErrUnexpectedValue; |
|
871 } |
|
872 return err; |
|
873 } |
|
874 |
|
875 // ----------------------------------------------------------------------------- |
|
876 // CCommonTestClass::MpxMediaTypeIndex() |
|
877 // Returns: Symbian OS errors. |
|
878 // ----------------------------------------------------------------------------- |
|
879 TInt CCommonTestClass::MpxMediaTypeIndex(CStifItemParser& aItem) |
|
880 { |
|
881 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaTypeIndex testing CMPXMedia::Type() begin"))); |
|
882 iLog->Log(_L("CCommonTestClass::MpxMediaTypeIndex testing CMPXMedia::Type() begin")); |
|
883 TInt err=KErrNone; |
|
884 TUint mediaIndex; |
|
885 TUint index; |
|
886 TInt expectedType; |
|
887 |
|
888 // read in parameters |
|
889 if ( aItem.GetNextInt(mediaIndex) ) |
|
890 { |
|
891 iLog->Log(_L("Missing Parameter: Media index.")); |
|
892 return KErrBadTestParameter; |
|
893 } |
|
894 if ( !iMPXMediaArray ) |
|
895 { |
|
896 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
897 return KErrBadTestParameter; |
|
898 } |
|
899 if ( mediaIndex >= iMPXMediaArray->Count() ) |
|
900 { |
|
901 iLog->Log(_L("Bad Parameter: Media index out of range.")); |
|
902 return KErrBadTestParameter; |
|
903 } |
|
904 if ( aItem.GetNextInt(index) ) |
|
905 { |
|
906 iLog->Log(_L("Missing Parameter: Index of Attribute.")); |
|
907 return KErrBadTestParameter; |
|
908 } |
|
909 if ( index >= (*iMPXMediaArray)[mediaIndex]->Count() ) |
|
910 { |
|
911 iLog->Log(_L("Bad Parameter: Index of Attribute out of range.")); |
|
912 return KErrBadTestParameter; |
|
913 } |
|
914 if ( aItem.GetNextInt(expectedType) ) |
|
915 { |
|
916 iLog->Log(_L("Missing Parameter: Expected Type.")); |
|
917 return KErrBadTestParameter; |
|
918 } |
|
919 |
|
920 TMPXAttributeType type = (*iMPXMediaArray)[mediaIndex]->Type(index); |
|
921 // verification |
|
922 if ( type != expectedType ) |
|
923 { |
|
924 iLog->Log(_L("Verification Failed: type=%d, expectedType=%d."), type, expectedType); |
|
925 err = KErrUnexpectedValue; |
|
926 } |
|
927 return err; |
|
928 } |
|
929 |
|
930 // ----------------------------------------------------------------------------- |
|
931 // CCommonTestClass::MpxMediaTypeAttribute() |
|
932 // Returns: Symbian OS errors. |
|
933 // ----------------------------------------------------------------------------- |
|
934 TInt CCommonTestClass::MpxMediaTypeAttribute(CStifItemParser& aItem) |
|
935 { |
|
936 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaTypeAttribute testing CMPXMedia::Type() begin"))); |
|
937 iLog->Log(_L("CCommonTestClass::MpxMediaTypeAttribute testing CMPXMedia::Type() begin")); |
|
938 TInt err=KErrNone; |
|
939 TUint mediaIndex; |
|
940 TUint attIndex; |
|
941 TInt expectedType; |
|
942 |
|
943 // read in parameters |
|
944 if ( aItem.GetNextInt(mediaIndex) ) |
|
945 { |
|
946 iLog->Log(_L("Missing Parameter: Media index.")); |
|
947 return KErrBadTestParameter; |
|
948 } |
|
949 if ( !iMPXMediaArray ) |
|
950 { |
|
951 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
952 return KErrBadTestParameter; |
|
953 } |
|
954 if ( mediaIndex >= iMPXMediaArray->Count() ) |
|
955 { |
|
956 iLog->Log(_L("Bad Parameter: Media index out of range.")); |
|
957 return KErrBadTestParameter; |
|
958 } |
|
959 if ( aItem.GetNextInt(attIndex) ) |
|
960 { |
|
961 iLog->Log(_L("Missing Parameter: Attribute Index.")); |
|
962 return KErrBadTestParameter; |
|
963 } |
|
964 if ( attIndex >= iMPXAttArray.Count() ) |
|
965 { |
|
966 iLog->Log(_L("Bad Parameter: Attribute Index out of range.")); |
|
967 return KErrBadTestParameter; |
|
968 } |
|
969 if ( aItem.GetNextInt(expectedType) ) |
|
970 { |
|
971 iLog->Log(_L("Missing Parameter: Expected Type.")); |
|
972 return KErrBadTestParameter; |
|
973 } |
|
974 |
|
975 TMPXAttributeType type = (*iMPXMediaArray)[mediaIndex]->Type(iMPXAttArray[attIndex]); |
|
976 // verification |
|
977 if ( type != expectedType ) |
|
978 { |
|
979 iLog->Log(_L("Verification Failed: type=%d, expectedType=%d."), type, expectedType); |
|
980 err = KErrUnexpectedValue; |
|
981 } |
|
982 return err; |
|
983 } |
|
984 |
|
985 // ----------------------------------------------------------------------------- |
|
986 // CCommonTestClass::MpxMediaReset() |
|
987 // Returns: Symbian OS errors. |
|
988 // ----------------------------------------------------------------------------- |
|
989 TInt CCommonTestClass::MpxMediaReset(CStifItemParser& aItem) |
|
990 { |
|
991 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaReset testing CMPXMedia::Reset() begin"))); |
|
992 iLog->Log(_L("CCommonTestClass::MpxMediaReset testing CMPXMedia::Reset() begin")); |
|
993 TInt err=KErrNone; |
|
994 TUint mediaIndex; |
|
995 |
|
996 // read in parameters |
|
997 if ( aItem.GetNextInt(mediaIndex) ) |
|
998 { |
|
999 iLog->Log(_L("Missing Parameter: Media index.")); |
|
1000 return KErrBadTestParameter; |
|
1001 } |
|
1002 if ( !iMPXMediaArray ) |
|
1003 { |
|
1004 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
1005 return KErrBadTestParameter; |
|
1006 } |
|
1007 if ( mediaIndex >= iMPXMediaArray->Count() ) |
|
1008 { |
|
1009 iLog->Log(_L("Bad Parameter: Media index out of range.")); |
|
1010 return KErrBadTestParameter; |
|
1011 } |
|
1012 |
|
1013 (*iMPXMediaArray)[mediaIndex]->Reset(); |
|
1014 return err; |
|
1015 } |
|
1016 |
|
1017 // ----------------------------------------------------------------------------- |
|
1018 // CCommonTestClass::MpxMediaDeleteAttribute() |
|
1019 // Returns: Symbian OS errors. |
|
1020 // ----------------------------------------------------------------------------- |
|
1021 TInt CCommonTestClass::MpxMediaDeleteAttribute(CStifItemParser& aItem) |
|
1022 { |
|
1023 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaDeleteAttribute testing CMPXMedia::Delete() begin"))); |
|
1024 iLog->Log(_L("CCommonTestClass::MpxMediaDeleteAttribute testing CMPXMedia::Delete() begin")); |
|
1025 TInt err=KErrNone; |
|
1026 TUint mediaIndex; |
|
1027 TUint attIndex; |
|
1028 |
|
1029 // read in parameters |
|
1030 if ( aItem.GetNextInt(mediaIndex) ) |
|
1031 { |
|
1032 iLog->Log(_L("Missing Parameter: Media index.")); |
|
1033 return KErrBadTestParameter; |
|
1034 } |
|
1035 if ( !iMPXMediaArray ) |
|
1036 { |
|
1037 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
1038 return KErrBadTestParameter; |
|
1039 } |
|
1040 if ( mediaIndex >= iMPXMediaArray->Count() ) |
|
1041 { |
|
1042 iLog->Log(_L("Bad Parameter: Media index out of range.")); |
|
1043 return KErrBadTestParameter; |
|
1044 } |
|
1045 if ( aItem.GetNextInt(attIndex) ) |
|
1046 { |
|
1047 iLog->Log(_L("Missing Parameter: Attribute Index.")); |
|
1048 return KErrBadTestParameter; |
|
1049 } |
|
1050 if ( attIndex >= iMPXAttArray.Count() ) |
|
1051 { |
|
1052 iLog->Log(_L("Bad Parameter: Attribute Index out of range.")); |
|
1053 return KErrBadTestParameter; |
|
1054 } |
|
1055 |
|
1056 (*iMPXMediaArray)[mediaIndex]->Delete(iMPXAttArray[attIndex]); |
|
1057 return err; |
|
1058 } |
|
1059 |
|
1060 // ----------------------------------------------------------------------------- |
|
1061 // CCommonTestClass::MpxMediaDeleteIndex() |
|
1062 // Returns: Symbian OS errors. |
|
1063 // ----------------------------------------------------------------------------- |
|
1064 TInt CCommonTestClass::MpxMediaDeleteIndex(CStifItemParser& aItem) |
|
1065 { |
|
1066 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaDeleteIndex testing CMPXMedia::Delete() begin"))); |
|
1067 iLog->Log(_L("CCommonTestClass::MpxMediaDeleteIndex testing CMPXMedia::Delete() begin")); |
|
1068 TInt err=KErrNone; |
|
1069 TUint mediaIndex; |
|
1070 TUint index; |
|
1071 |
|
1072 // read in parameters |
|
1073 if ( aItem.GetNextInt(mediaIndex) ) |
|
1074 { |
|
1075 iLog->Log(_L("Missing Parameter: Media index.")); |
|
1076 return KErrBadTestParameter; |
|
1077 } |
|
1078 if ( !iMPXMediaArray ) |
|
1079 { |
|
1080 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
1081 return KErrBadTestParameter; |
|
1082 } |
|
1083 if ( mediaIndex >= iMPXMediaArray->Count() ) |
|
1084 { |
|
1085 iLog->Log(_L("Bad Parameter: Media index out of range.")); |
|
1086 return KErrBadTestParameter; |
|
1087 } |
|
1088 if ( aItem.GetNextInt(index) ) |
|
1089 { |
|
1090 iLog->Log(_L("Missing Parameter: Index of Attribute.")); |
|
1091 return KErrBadTestParameter; |
|
1092 } |
|
1093 if ( index >= (*iMPXMediaArray)[mediaIndex]->Count() ) |
|
1094 { |
|
1095 iLog->Log(_L("Bad Parameter: Index of Attribute out of range.")); |
|
1096 return KErrBadTestParameter; |
|
1097 } |
|
1098 |
|
1099 (*iMPXMediaArray)[mediaIndex]->Delete(index); |
|
1100 return err; |
|
1101 } |
|
1102 |
|
1103 // ----------------------------------------------------------------------------- |
|
1104 // CCommonTestClass::MpxMediaValueText() |
|
1105 // Returns: Symbian OS errors. |
|
1106 // ----------------------------------------------------------------------------- |
|
1107 TInt CCommonTestClass::MpxMediaValueText(CStifItemParser& aItem) |
|
1108 { |
|
1109 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaValueText testing CMPXMedia::ValueText() begin"))); |
|
1110 iLog->Log(_L("CCommonTestClass::MpxMediaValueText testing CMPXMedia::ValueText() begin")); |
|
1111 TInt err=KErrNone; |
|
1112 TUint mediaIndex; |
|
1113 TUint attIndex; |
|
1114 TPtrC expectedValue; |
|
1115 |
|
1116 // read in parameters |
|
1117 if ( aItem.GetNextInt(mediaIndex) ) |
|
1118 { |
|
1119 iLog->Log(_L("Missing Parameter: Media index.")); |
|
1120 return KErrBadTestParameter; |
|
1121 } |
|
1122 if ( !iMPXMediaArray ) |
|
1123 { |
|
1124 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
1125 return KErrBadTestParameter; |
|
1126 } |
|
1127 if ( mediaIndex >= iMPXMediaArray->Count() ) |
|
1128 { |
|
1129 iLog->Log(_L("Bad Parameter: Media index out of range.")); |
|
1130 return KErrBadTestParameter; |
|
1131 } |
|
1132 if ( aItem.GetNextInt(attIndex) ) |
|
1133 { |
|
1134 iLog->Log(_L("Missing Parameter: Attribute Index.")); |
|
1135 return KErrBadTestParameter; |
|
1136 } |
|
1137 if ( attIndex >= iMPXAttArray.Count() ) |
|
1138 { |
|
1139 iLog->Log(_L("Bad Parameter: Attribute Index out of range.")); |
|
1140 return KErrBadTestParameter; |
|
1141 } |
|
1142 if ( aItem.GetNextString(expectedValue) ) |
|
1143 { |
|
1144 iLog->Log(_L("Missing Parameter: Attribute value.")); |
|
1145 return KErrBadTestParameter; |
|
1146 } |
|
1147 |
|
1148 TPtrC value((*iMPXMediaArray)[mediaIndex]->ValueText(iMPXAttArray[attIndex])); |
|
1149 // verification |
|
1150 if ( value != expectedValue ) |
|
1151 { |
|
1152 iLog->Log(_L("Verification Failed: value=%S, expectedValue=%S."), &value, &expectedValue); |
|
1153 err = KErrUnexpectedValue; |
|
1154 } |
|
1155 return err; |
|
1156 } |
|
1157 |
|
1158 // ----------------------------------------------------------------------------- |
|
1159 // CCommonTestClass::MpxMediaValue() |
|
1160 // Returns: Symbian OS errors. |
|
1161 // ----------------------------------------------------------------------------- |
|
1162 TInt CCommonTestClass::MpxMediaValue(CStifItemParser& aItem) |
|
1163 { |
|
1164 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaValue testing CMPXMedia::Value() begin"))); |
|
1165 iLog->Log(_L("CCommonTestClass::MpxMediaValue testing CMPXMedia::Value() begin")); |
|
1166 TInt err=KErrNone; |
|
1167 TUint mediaIndex; |
|
1168 TUint attIndex; |
|
1169 TPtrC className; |
|
1170 |
|
1171 // read in parameters |
|
1172 if ( aItem.GetNextInt(mediaIndex) ) |
|
1173 { |
|
1174 iLog->Log(_L("Missing Parameter: Media index.")); |
|
1175 return KErrBadTestParameter; |
|
1176 } |
|
1177 if ( !iMPXMediaArray ) |
|
1178 { |
|
1179 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
1180 return KErrBadTestParameter; |
|
1181 } |
|
1182 if ( mediaIndex >= iMPXMediaArray->Count() ) |
|
1183 { |
|
1184 iLog->Log(_L("Bad Parameter: Media index out of range.")); |
|
1185 return KErrBadTestParameter; |
|
1186 } |
|
1187 if ( aItem.GetNextInt(attIndex) ) |
|
1188 { |
|
1189 iLog->Log(_L("Missing Parameter: Attribute Index.")); |
|
1190 return KErrBadTestParameter; |
|
1191 } |
|
1192 if ( attIndex >= iMPXAttArray.Count() ) |
|
1193 { |
|
1194 iLog->Log(_L("Bad Parameter: Attribute Index out of range.")); |
|
1195 return KErrBadTestParameter; |
|
1196 } |
|
1197 if ( aItem.GetNextString(className) ) |
|
1198 { |
|
1199 iLog->Log(_L("Missing Parameter: Class name.")); |
|
1200 return KErrBadTestParameter; |
|
1201 } |
|
1202 |
|
1203 // get attribute value |
|
1204 if ( className == _L("CMPXMedia") ) |
|
1205 { |
|
1206 CMPXMedia* media = (*iMPXMediaArray)[mediaIndex]->Value<CMPXMedia>(iMPXAttArray[attIndex]); |
|
1207 // verification |
|
1208 if ( !media ) |
|
1209 { |
|
1210 iLog->Log(_L("Verification Failed: Function returned NULL.")); |
|
1211 err = KErrUnexpectedValue; |
|
1212 } |
|
1213 } |
|
1214 else if ( className == _L("CMPXMediaArray") ) |
|
1215 { |
|
1216 CMPXMediaArray* media = (*iMPXMediaArray)[mediaIndex]->Value<CMPXMediaArray>(iMPXAttArray[attIndex]); |
|
1217 // verification |
|
1218 if ( !media ) |
|
1219 { |
|
1220 iLog->Log(_L("Verification Failed: Function returned NULL.")); |
|
1221 err = KErrUnexpectedValue; |
|
1222 } |
|
1223 } |
|
1224 else if ( className == _L("CMPXCollectionPath") ) |
|
1225 { |
|
1226 CMPXCollectionPath* media = (*iMPXMediaArray)[mediaIndex]->Value<CMPXCollectionPath>(iMPXAttArray[attIndex]); |
|
1227 // verification |
|
1228 if ( !media ) |
|
1229 { |
|
1230 iLog->Log(_L("Verification Failed: Function returned NULL.")); |
|
1231 err = KErrUnexpectedValue; |
|
1232 } |
|
1233 } |
|
1234 else |
|
1235 { |
|
1236 iLog->Log(_L("Bad Parameter: Invalid class name.")); |
|
1237 return KErrBadTestParameter; |
|
1238 } |
|
1239 return err; |
|
1240 } |
|
1241 |
|
1242 // ----------------------------------------------------------------------------- |
|
1243 // CCommonTestClass::MpxMediaValueTObjectL() |
|
1244 // Returns: Symbian OS errors. |
|
1245 // ----------------------------------------------------------------------------- |
|
1246 TInt CCommonTestClass::MpxMediaValueTObjectL(CStifItemParser& aItem) |
|
1247 { |
|
1248 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaValueTObjectL testing CMPXMedia::ValueTObjectL() begin"))); |
|
1249 iLog->Log(_L("CCommonTestClass::MpxMediaValueTObjectL testing CMPXMedia::ValueTObjectL() begin")); |
|
1250 TInt err=KErrNone; |
|
1251 TUint mediaIndex; |
|
1252 TUint attIndex; |
|
1253 TInt expectedValue; |
|
1254 |
|
1255 // read in parameters |
|
1256 if ( aItem.GetNextInt(mediaIndex) ) |
|
1257 { |
|
1258 iLog->Log(_L("Missing Parameter: Media index.")); |
|
1259 return KErrBadTestParameter; |
|
1260 } |
|
1261 if ( !iMPXMediaArray ) |
|
1262 { |
|
1263 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
1264 return KErrBadTestParameter; |
|
1265 } |
|
1266 if ( mediaIndex >= iMPXMediaArray->Count() ) |
|
1267 { |
|
1268 iLog->Log(_L("Bad Parameter: Media index out of range.")); |
|
1269 return KErrBadTestParameter; |
|
1270 } |
|
1271 if ( aItem.GetNextInt(attIndex) ) |
|
1272 { |
|
1273 iLog->Log(_L("Missing Parameter: Attribute Index.")); |
|
1274 return KErrBadTestParameter; |
|
1275 } |
|
1276 if ( attIndex >= iMPXAttArray.Count() ) |
|
1277 { |
|
1278 iLog->Log(_L("Bad Parameter: Attribute Index out of range.")); |
|
1279 return KErrBadTestParameter; |
|
1280 } |
|
1281 if ( aItem.GetNextInt(expectedValue) ) |
|
1282 { |
|
1283 iLog->Log(_L("Missing Parameter: Expected value.")); |
|
1284 return KErrBadTestParameter; |
|
1285 } |
|
1286 |
|
1287 // get attribute value |
|
1288 TInt value = (*iMPXMediaArray)[mediaIndex]->ValueTObjectL<TInt>(iMPXAttArray[attIndex]); |
|
1289 // verification |
|
1290 if ( value != expectedValue ) |
|
1291 { |
|
1292 iLog->Log(_L("Verification Failed: value=%d, expectedValue=%d."), value, expectedValue); |
|
1293 err = KErrUnexpectedValue; |
|
1294 } |
|
1295 return err; |
|
1296 } |
|
1297 |
|
1298 // ----------------------------------------------------------------------------- |
|
1299 // CCommonTestClass::MpxMediaValueCObjectL() |
|
1300 // Returns: Symbian OS errors. |
|
1301 // ----------------------------------------------------------------------------- |
|
1302 TInt CCommonTestClass::MpxMediaValueCObjectL(CStifItemParser& aItem) |
|
1303 { |
|
1304 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaValueCObjectL testing CMPXMedia::ValueCObjectL() begin"))); |
|
1305 iLog->Log(_L("CCommonTestClass::MpxMediaValueCObjectL testing CMPXMedia::ValueCObjectL() begin")); |
|
1306 TInt err=KErrNone; |
|
1307 TUint mediaIndex; |
|
1308 TUint attIndex; |
|
1309 TPtrC className; |
|
1310 |
|
1311 // read in parameters |
|
1312 if ( aItem.GetNextInt(mediaIndex) ) |
|
1313 { |
|
1314 iLog->Log(_L("Missing Parameter: Media index.")); |
|
1315 return KErrBadTestParameter; |
|
1316 } |
|
1317 if ( !iMPXMediaArray ) |
|
1318 { |
|
1319 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
1320 return KErrBadTestParameter; |
|
1321 } |
|
1322 if ( mediaIndex >= iMPXMediaArray->Count() ) |
|
1323 { |
|
1324 iLog->Log(_L("Bad Parameter: Media index out of range.")); |
|
1325 return KErrBadTestParameter; |
|
1326 } |
|
1327 if ( aItem.GetNextInt(attIndex) ) |
|
1328 { |
|
1329 iLog->Log(_L("Missing Parameter: Attribute Index.")); |
|
1330 return KErrBadTestParameter; |
|
1331 } |
|
1332 if ( attIndex >= iMPXAttArray.Count() ) |
|
1333 { |
|
1334 iLog->Log(_L("Bad Parameter: Attribute Index out of range.")); |
|
1335 return KErrBadTestParameter; |
|
1336 } |
|
1337 if ( aItem.GetNextString(className) ) |
|
1338 { |
|
1339 iLog->Log(_L("Missing Parameter: Class name.")); |
|
1340 return KErrBadTestParameter; |
|
1341 } |
|
1342 |
|
1343 // Verify Attribute |
|
1344 if ( !(*iMPXMediaArray)[mediaIndex]->IsSupported(iMPXAttArray[attIndex]) ) |
|
1345 { |
|
1346 iLog->Log(_L("Bad Parameter: Invalid Attribute.")); |
|
1347 return KErrBadTestParameter; |
|
1348 } |
|
1349 // get attribute value |
|
1350 if ( className == _L("CMPXMedia") ) |
|
1351 { |
|
1352 CMPXMedia* media = (*iMPXMediaArray)[mediaIndex]->ValueCObjectL<CMPXMedia>(iMPXAttArray[attIndex]); |
|
1353 delete media; |
|
1354 } |
|
1355 else if ( className == _L("CMPXMediaArray") ) |
|
1356 { |
|
1357 CMPXMediaArray* media = (*iMPXMediaArray)[mediaIndex]->ValueCObjectL<CMPXMediaArray>(iMPXAttArray[attIndex]); |
|
1358 delete media; |
|
1359 } |
|
1360 else if ( className == _L("CMPXCollectionPath") ) |
|
1361 { |
|
1362 CMPXCollectionPath* path = (*iMPXMediaArray)[mediaIndex]->ValueCObjectL<CMPXCollectionPath>(iMPXAttArray[attIndex]); |
|
1363 delete path; |
|
1364 } |
|
1365 else |
|
1366 { |
|
1367 iLog->Log(_L("Bad Parameter: Invalid class name.")); |
|
1368 return KErrBadTestParameter; |
|
1369 } |
|
1370 return err; |
|
1371 } |
|
1372 |
|
1373 // ----------------------------------------------------------------------------- |
|
1374 // CCommonTestClass::MpxMediaValueNoNewLCObjectL() |
|
1375 // Returns: Symbian OS errors. |
|
1376 // ----------------------------------------------------------------------------- |
|
1377 TInt CCommonTestClass::MpxMediaValueNoNewLCObjectL(CStifItemParser& /*aItem*/) |
|
1378 { |
|
1379 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaValueNoNewLCObjectL testing CMPXMedia::ValueNoNewLCObjectL() begin"))); |
|
1380 iLog->Log(_L("CCommonTestClass::MpxMediaValueNoNewLCObjectL testing CMPXMedia::ValueNoNewLCObjectL() begin")); |
|
1381 TInt err=KErrNone; |
|
1382 |
|
1383 return err; |
|
1384 } |
|
1385 |
|
1386 // ----------------------------------------------------------------------------- |
|
1387 // CCommonTestClass::MpxMediaStreamingL() |
|
1388 // Returns: Symbian OS errors. |
|
1389 // ----------------------------------------------------------------------------- |
|
1390 TInt CCommonTestClass::MpxMediaStreamingL(CStifItemParser& aItem) |
|
1391 { |
|
1392 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaStreamingL testing CMPXMedia ExternalizeL and InternalizeL begin"))); |
|
1393 iLog->Log(_L("CCommonTestClass::MpxMediaStreamingL testing CMPXMedia ExternalizeL and InternalizeL begin")); |
|
1394 TInt err=KErrNone; |
|
1395 TUint mediaIndex; |
|
1396 |
|
1397 // read in parameters |
|
1398 if ( aItem.GetNextInt(mediaIndex) ) |
|
1399 { |
|
1400 iLog->Log(_L("Missing Parameter: Media index.")); |
|
1401 return KErrBadTestParameter; |
|
1402 } |
|
1403 if ( !iMPXMediaArray ) |
|
1404 { |
|
1405 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
1406 return KErrBadTestParameter; |
|
1407 } |
|
1408 if ( mediaIndex >= iMPXMediaArray->Count() ) |
|
1409 { |
|
1410 iLog->Log(_L("Bad Parameter: Media index out of range.")); |
|
1411 return KErrBadTestParameter; |
|
1412 } |
|
1413 |
|
1414 iLog->Log(_L("Start ExternalizeL")); |
|
1415 CBufBase* buffer = CBufFlat::NewL( 200 ); |
|
1416 CleanupStack::PushL( buffer ); |
|
1417 RBufWriteStream writeStream( *buffer ); |
|
1418 CleanupClosePushL( writeStream ); |
|
1419 (*iMPXMediaArray)[mediaIndex]->ExternalizeL( writeStream ); |
|
1420 writeStream.CommitL(); |
|
1421 buffer->Compress(); |
|
1422 CleanupStack::PopAndDestroy( &writeStream ); |
|
1423 |
|
1424 iLog->Log(_L("Start InternalizeL")); |
|
1425 RBufReadStream readStream( *buffer ); |
|
1426 CleanupClosePushL( readStream ); |
|
1427 CMPXMedia* media = CMPXMedia::NewL(); |
|
1428 CleanupStack::PushL( media ); |
|
1429 media->InternalizeL( readStream ); |
|
1430 // verification |
|
1431 for (TInt i=0;i<(*iMPXMediaArray)[mediaIndex]->Count();i++) |
|
1432 { |
|
1433 if ( media->IsSupported((*iMPXMediaArray)[mediaIndex]->Attribute(i)) == EFalse ) |
|
1434 { |
|
1435 iLog->Log(_L("Verification Failed: Attribute at index %d is not supported."), i); |
|
1436 err = KErrUnexpectedValue; |
|
1437 } |
|
1438 } |
|
1439 CleanupStack::PopAndDestroy( media ); |
|
1440 CleanupStack::PopAndDestroy( &readStream ); |
|
1441 CleanupStack::PopAndDestroy( buffer ); |
|
1442 return err; |
|
1443 } |
|
1444 |
|
1445 // ----------------------------------------------------------------------------- |
|
1446 // CCommonTestClass::MpxMediaArrayNewL() |
|
1447 // Returns: Symbian OS errors. |
|
1448 // ----------------------------------------------------------------------------- |
|
1449 TInt CCommonTestClass::MpxMediaArrayNewL(CStifItemParser& /*aItem*/) |
|
1450 { |
|
1451 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayNewL testing CMPXMediaArray::NewL() begin"))); |
|
1452 iLog->Log(_L("CCommonTestClass::MpxMediaArrayNewL testing CMPXMediaArray::NewL() begin")); |
|
1453 TInt err=KErrNone; |
|
1454 |
|
1455 if ( iMPXMediaArray ) |
|
1456 { |
|
1457 delete iMPXMediaArray; |
|
1458 iMPXMediaArray = NULL; |
|
1459 } |
|
1460 iMPXMediaArray = CMPXMediaArray::NewL(); |
|
1461 return err; |
|
1462 } |
|
1463 |
|
1464 // ----------------------------------------------------------------------------- |
|
1465 // CCommonTestClass::MpxMediaArrayNewLMediaArrayL() |
|
1466 // Returns: Symbian OS errors. |
|
1467 // ----------------------------------------------------------------------------- |
|
1468 TInt CCommonTestClass::MpxMediaArrayNewLMediaArrayL(CStifItemParser& /*aItem*/) |
|
1469 { |
|
1470 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayNewLMediaArrayL testing CMPXMediaArray::NewL() begin"))); |
|
1471 iLog->Log(_L("CCommonTestClass::MpxMediaArrayNewLMediaArrayL testing CMPXMediaArray::NewL() begin")); |
|
1472 TInt err=KErrNone; |
|
1473 |
|
1474 if ( !iMPXMediaArray ) |
|
1475 { |
|
1476 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
1477 return KErrBadTestParameter; |
|
1478 } |
|
1479 CMPXMediaArray* mediaArray = CMPXMediaArray::NewL(*iMPXMediaArray); |
|
1480 // verification |
|
1481 if ( mediaArray->Count() != iMPXMediaArray->Count() ) |
|
1482 { |
|
1483 iLog->Log(_L("Verification Failed: New array count=%d, old array count=%d."), |
|
1484 mediaArray->Count(), iMPXMediaArray->Count()); |
|
1485 err = KErrUnexpectedValue; |
|
1486 } |
|
1487 delete mediaArray; |
|
1488 return err; |
|
1489 } |
|
1490 |
|
1491 // ----------------------------------------------------------------------------- |
|
1492 // CCommonTestClass::MpxMediaArrayCount() |
|
1493 // Returns: Symbian OS errors. |
|
1494 // ----------------------------------------------------------------------------- |
|
1495 TInt CCommonTestClass::MpxMediaArrayCount(CStifItemParser& aItem) |
|
1496 { |
|
1497 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayCount testing CMPXMediaArray::Count() begin"))); |
|
1498 iLog->Log(_L("CCommonTestClass::MpxMediaArrayCount testing CMPXMediaArray::Count() begin")); |
|
1499 TInt err=KErrNone; |
|
1500 TUint expectedCount; |
|
1501 |
|
1502 // read in parameters |
|
1503 if ( aItem.GetNextInt(expectedCount) ) |
|
1504 { |
|
1505 iLog->Log(_L("Missing Parameter: Expected count.")); |
|
1506 return KErrBadTestParameter; |
|
1507 } |
|
1508 |
|
1509 TInt count = iMPXMediaArray->Count(); |
|
1510 // verification |
|
1511 if ( count != expectedCount ) |
|
1512 { |
|
1513 iLog->Log(_L("Verification Failed: count=%d, expectedCount=%d."), count, expectedCount); |
|
1514 err = KErrUnexpectedValue; |
|
1515 } |
|
1516 return err; |
|
1517 } |
|
1518 |
|
1519 // ----------------------------------------------------------------------------- |
|
1520 // CCommonTestClass::MpxMediaArrayAtLByIndexL() |
|
1521 // Returns: Symbian OS errors. |
|
1522 // ----------------------------------------------------------------------------- |
|
1523 TInt CCommonTestClass::MpxMediaArrayAtLByIndexL(CStifItemParser& aItem) |
|
1524 { |
|
1525 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayAtLByIndexL testing CMPXMediaArray::Count() begin"))); |
|
1526 iLog->Log(_L("CCommonTestClass::MpxMediaArrayAtLByIndexL testing CMPXMediaArray::Count() begin")); |
|
1527 TInt err = KErrNone; |
|
1528 |
|
1529 TUint expectedIndex; |
|
1530 |
|
1531 // read in parameters |
|
1532 if ( aItem.GetNextInt(expectedIndex) ) |
|
1533 { |
|
1534 iLog->Log(_L("Missing Parameter: Expected Index.")); |
|
1535 return KErrBadTestParameter; |
|
1536 } |
|
1537 TInt count = iMPXMediaArray->Count(); |
|
1538 if( expectedIndex >= count ) |
|
1539 { |
|
1540 iLog->Log(_L("Incorrect Parameter: Expected Index greater than the count of media array.")); |
|
1541 return KErrBadTestParameter; |
|
1542 } |
|
1543 CMPXMedia* media = iMPXMediaArray->AtL( expectedIndex ); |
|
1544 |
|
1545 if( media ) |
|
1546 { |
|
1547 iLog->Log(_L("MpxMediaArray::AtL(TInt aIndex) tested seccessfully.")); |
|
1548 return err; |
|
1549 } |
|
1550 else |
|
1551 { |
|
1552 iLog->Log(_L("No media pointer returns.")); |
|
1553 return KErrBadTestParameter; |
|
1554 } |
|
1555 } |
|
1556 |
|
1557 |
|
1558 // ----------------------------------------------------------------------------- |
|
1559 // CCommonTestClass::MpxMediaArrayAppendLByPtrL() |
|
1560 // Returns: Symbian OS errors. |
|
1561 // ----------------------------------------------------------------------------- |
|
1562 TInt CCommonTestClass::MpxMediaArrayAppendLByPtrL(CStifItemParser& /*aItem*/) |
|
1563 { |
|
1564 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayAppendLByPtrL testing CMPXMediaArray::AppendL() begin"))); |
|
1565 iLog->Log(_L("CCommonTestClass::MpxMediaArrayAppendLByPtrL testing CMPXMediaArray::AppendL() begin")); |
|
1566 TInt err=KErrNone; |
|
1567 |
|
1568 CMPXMedia* media = CMPXMedia::NewL(); |
|
1569 CleanupStack::PushL(media); |
|
1570 iMPXMediaArray->AppendL(media); |
|
1571 CleanupStack::Pop(media); |
|
1572 return err; |
|
1573 } |
|
1574 |
|
1575 // ----------------------------------------------------------------------------- |
|
1576 // CCommonTestClass::MpxMediaArrayAppendLByRefL() |
|
1577 // Returns: Symbian OS errors. |
|
1578 // ----------------------------------------------------------------------------- |
|
1579 TInt CCommonTestClass::MpxMediaArrayAppendLByRefL(CStifItemParser& /*aItem*/) |
|
1580 { |
|
1581 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayAppendLByRefL testing CMPXMediaArray::AppendL() begin"))); |
|
1582 iLog->Log(_L("CCommonTestClass::MpxMediaArrayAppendLByRefL testing CMPXMediaArray::AppendL() begin")); |
|
1583 TInt err=KErrNone; |
|
1584 |
|
1585 CMPXMedia* media = CMPXMedia::NewL(); |
|
1586 CleanupStack::PushL(media); |
|
1587 iMPXMediaArray->AppendL(*media); |
|
1588 CleanupStack::PopAndDestroy(media); |
|
1589 return err; |
|
1590 } |
|
1591 |
|
1592 // ----------------------------------------------------------------------------- |
|
1593 // CCommonTestClass::MpxMediaArrayReset() |
|
1594 // Returns: Symbian OS errors. |
|
1595 // ----------------------------------------------------------------------------- |
|
1596 TInt CCommonTestClass::MpxMediaArrayReset(CStifItemParser& /*aItem*/) |
|
1597 { |
|
1598 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayReset testing CMPXMediaArray::Reset() begin"))); |
|
1599 iLog->Log(_L("CCommonTestClass::MpxMediaArrayReset testing CMPXMediaArray::Reset() begin")); |
|
1600 TInt err=KErrNone; |
|
1601 |
|
1602 iMPXMediaArray->Reset(); |
|
1603 return err; |
|
1604 } |
|
1605 |
|
1606 // ----------------------------------------------------------------------------- |
|
1607 // CCommonTestClass::MpxMediaArrayRemove() |
|
1608 // Returns: Symbian OS errors. |
|
1609 // ----------------------------------------------------------------------------- |
|
1610 TInt CCommonTestClass::MpxMediaArrayRemove(CStifItemParser& aItem) |
|
1611 { |
|
1612 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayRemove testing CMPXMediaArray::Remove() begin"))); |
|
1613 iLog->Log(_L("CCommonTestClass::MpxMediaArrayRemove testing CMPXMediaArray::Remove() begin")); |
|
1614 TInt err=KErrNone; |
|
1615 TUint index; |
|
1616 |
|
1617 // read in parameters |
|
1618 if ( aItem.GetNextInt(index) ) |
|
1619 { |
|
1620 iLog->Log(_L("Missing Parameter: Index.")); |
|
1621 return KErrBadTestParameter; |
|
1622 } |
|
1623 // verify index |
|
1624 if ( index >= iMPXMediaArray->Count() ) |
|
1625 { |
|
1626 iLog->Log(_L("Bad Parameter: Index out of range.")); |
|
1627 return KErrBadTestParameter; |
|
1628 } |
|
1629 |
|
1630 iMPXMediaArray->Remove(index); |
|
1631 return err; |
|
1632 } |
|
1633 |
|
1634 // ----------------------------------------------------------------------------- |
|
1635 // CCommonTestClass::MpxMediaArrayInsertByPtr() |
|
1636 // Returns: Symbian OS errors. |
|
1637 // ----------------------------------------------------------------------------- |
|
1638 TInt CCommonTestClass::MpxMediaArrayInsertByPtr(CStifItemParser& aItem) |
|
1639 { |
|
1640 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayInsertByPtr testing CMPXMediaArray::Insert() begin"))); |
|
1641 iLog->Log(_L("CCommonTestClass::MpxMediaArrayInsertByPtr testing CMPXMediaArray::Insert() begin")); |
|
1642 TInt err=KErrNone; |
|
1643 TUint index; |
|
1644 |
|
1645 // read in parameters |
|
1646 if ( aItem.GetNextInt(index) ) |
|
1647 { |
|
1648 iLog->Log(_L("Missing Parameter: Index.")); |
|
1649 return KErrBadTestParameter; |
|
1650 } |
|
1651 // verify index |
|
1652 if ( index > iMPXMediaArray->Count() ) |
|
1653 { |
|
1654 iLog->Log(_L("Bad Parameter: Index out of range.")); |
|
1655 return KErrBadTestParameter; |
|
1656 } |
|
1657 |
|
1658 CMPXMedia* media; |
|
1659 TRAP(err,media = CMPXMedia::NewL()); |
|
1660 err = iMPXMediaArray->Insert(media, index); |
|
1661 if ( err ) |
|
1662 { |
|
1663 iLog->Log(_L("Error: Insert return error code %d."), err); |
|
1664 delete media; |
|
1665 } |
|
1666 return err; |
|
1667 } |
|
1668 |
|
1669 // ----------------------------------------------------------------------------- |
|
1670 // CCommonTestClass::MpxMediaArrayInsertByRef() |
|
1671 // Returns: Symbian OS errors. |
|
1672 // ----------------------------------------------------------------------------- |
|
1673 TInt CCommonTestClass::MpxMediaArrayInsertByRef(CStifItemParser& aItem) |
|
1674 { |
|
1675 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayInsertByRef testing CMPXMediaArray::Insert() begin"))); |
|
1676 iLog->Log(_L("CCommonTestClass::MpxMediaArrayInsertByRef testing CMPXMediaArray::Insert() begin")); |
|
1677 TInt err=KErrNone; |
|
1678 TUint index; |
|
1679 |
|
1680 // read in parameters |
|
1681 if ( aItem.GetNextInt(index) ) |
|
1682 { |
|
1683 iLog->Log(_L("Missing Parameter: Index.")); |
|
1684 return KErrBadTestParameter; |
|
1685 } |
|
1686 // verify index |
|
1687 if ( index > iMPXMediaArray->Count() ) |
|
1688 { |
|
1689 iLog->Log(_L("Bad Parameter: Index out of range.")); |
|
1690 return KErrBadTestParameter; |
|
1691 } |
|
1692 |
|
1693 CMPXMedia* media; |
|
1694 TRAP(err , media= CMPXMedia::NewL()); |
|
1695 err = iMPXMediaArray->Insert(*media, index); |
|
1696 if ( err ) |
|
1697 { |
|
1698 iLog->Log(_L("Error: Insert return error code %d."), err); |
|
1699 } |
|
1700 delete media; |
|
1701 return err; |
|
1702 } |
|
1703 |
|
1704 // ----------------------------------------------------------------------------- |
|
1705 // CCommonTestClass::MpxMediaArrayInsertLByPtrL() |
|
1706 // Returns: Symbian OS errors. |
|
1707 // ----------------------------------------------------------------------------- |
|
1708 TInt CCommonTestClass::MpxMediaArrayInsertLByPtrL(CStifItemParser& aItem) |
|
1709 { |
|
1710 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayInsertLByPtrL testing CMPXMediaArray::InsertL() begin"))); |
|
1711 iLog->Log(_L("CCommonTestClass::MpxMediaArrayInsertLByPtrL testing CMPXMediaArray::InsertL() begin")); |
|
1712 TInt err=KErrNone; |
|
1713 TUint index; |
|
1714 |
|
1715 // read in parameters |
|
1716 if ( aItem.GetNextInt(index) ) |
|
1717 { |
|
1718 iLog->Log(_L("Missing Parameter: Index.")); |
|
1719 return KErrBadTestParameter; |
|
1720 } |
|
1721 // verify index |
|
1722 if ( index > iMPXMediaArray->Count() ) |
|
1723 { |
|
1724 iLog->Log(_L("Bad Parameter: Index out of range.")); |
|
1725 return KErrBadTestParameter; |
|
1726 } |
|
1727 |
|
1728 CMPXMedia* media; |
|
1729 TRAP(err , media= CMPXMedia::NewL()); |
|
1730 CleanupStack::PushL(media); |
|
1731 TRAP(err , iMPXMediaArray->InsertL(media, index)); |
|
1732 CleanupStack::Pop(media); |
|
1733 return err; |
|
1734 } |
|
1735 |
|
1736 // ----------------------------------------------------------------------------- |
|
1737 // CCommonTestClass::MpxMediaArrayInsertLByRefL() |
|
1738 // Returns: Symbian OS errors. |
|
1739 // ----------------------------------------------------------------------------- |
|
1740 TInt CCommonTestClass::MpxMediaArrayInsertLByRefL(CStifItemParser& aItem) |
|
1741 { |
|
1742 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayInsertLByRefL testing CMPXMediaArray::InsertL() begin"))); |
|
1743 iLog->Log(_L("CCommonTestClass::MpxMediaArrayInsertLByRefL testing CMPXMediaArray::InsertL() begin")); |
|
1744 TInt err=KErrNone; |
|
1745 TUint index; |
|
1746 |
|
1747 // read in parameters |
|
1748 if ( aItem.GetNextInt(index) ) |
|
1749 { |
|
1750 iLog->Log(_L("Missing Parameter: Index.")); |
|
1751 return KErrBadTestParameter; |
|
1752 } |
|
1753 // verify index |
|
1754 if ( index > iMPXMediaArray->Count() ) |
|
1755 { |
|
1756 iLog->Log(_L("Bad Parameter: Index out of range.")); |
|
1757 return KErrBadTestParameter; |
|
1758 } |
|
1759 |
|
1760 CMPXMedia* media; |
|
1761 TRAP(err , media= CMPXMedia::NewL()); |
|
1762 CleanupStack::PushL(media); |
|
1763 TRAP(err , iMPXMediaArray->InsertL(*media, index)); |
|
1764 CleanupStack::PopAndDestroy(media); |
|
1765 return err; |
|
1766 } |
|
1767 |
|
1768 // ----------------------------------------------------------------------------- |
|
1769 // CCommonTestClass::MpxMediaArraySet() |
|
1770 // Returns: Symbian OS errors. |
|
1771 // ----------------------------------------------------------------------------- |
|
1772 TInt CCommonTestClass::MpxMediaArraySet(CStifItemParser& aItem) |
|
1773 { |
|
1774 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArraySet testing CMPXMediaArray::Set() begin"))); |
|
1775 iLog->Log(_L("CCommonTestClass::MpxMediaArraySet testing CMPXMediaArray::Set() begin")); |
|
1776 TInt err=KErrNone; |
|
1777 TUint index; |
|
1778 |
|
1779 // read in parameters |
|
1780 if ( aItem.GetNextInt(index) ) |
|
1781 { |
|
1782 iLog->Log(_L("Missing Parameter: Index.")); |
|
1783 return KErrBadTestParameter; |
|
1784 } |
|
1785 // verify index |
|
1786 if ( index >= iMPXMediaArray->Count() ) |
|
1787 { |
|
1788 iLog->Log(_L("Bad Parameter: Index out of range.")); |
|
1789 return KErrBadTestParameter; |
|
1790 } |
|
1791 |
|
1792 CMPXMedia* media; |
|
1793 TRAP(err , media= CMPXMedia::NewL()); |
|
1794 CleanupStack::PushL(media); |
|
1795 iMPXMediaArray->Set(*media, index); |
|
1796 CleanupStack::PopAndDestroy(media); |
|
1797 return err; |
|
1798 } |
|
1799 |
|
1800 // ----------------------------------------------------------------------------- |
|
1801 // CCommonTestClass::MpxMediaArrayStreamingL() |
|
1802 // Returns: Symbian OS errors. |
|
1803 // ----------------------------------------------------------------------------- |
|
1804 TInt CCommonTestClass::MpxMediaArrayStreamingL(CStifItemParser& /*aItem*/) |
|
1805 { |
|
1806 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayStreamingL testing CMPXMediaArray ExternalizeL and InternalizeL begin"))); |
|
1807 iLog->Log(_L("CCommonTestClass::MpxMediaArrayStreamingL testing CMPXMediaArray ExternalizeL and InternalizeL begin")); |
|
1808 TInt err=KErrNone; |
|
1809 |
|
1810 iLog->Log(_L("Start ExternalizeL")); |
|
1811 CBufBase* buffer = CBufFlat::NewL( 200 ); |
|
1812 CleanupStack::PushL( buffer ); |
|
1813 RBufWriteStream writeStream( *buffer ); |
|
1814 CleanupClosePushL( writeStream ); |
|
1815 iMPXMediaArray->ExternalizeL( writeStream ); |
|
1816 writeStream.CommitL(); |
|
1817 buffer->Compress(); |
|
1818 CleanupStack::PopAndDestroy( &writeStream ); |
|
1819 |
|
1820 iLog->Log(_L("Start InternalizeL")); |
|
1821 RBufReadStream readStream( *buffer ); |
|
1822 CleanupClosePushL( readStream ); |
|
1823 CMPXMediaArray* media = CMPXMediaArray::NewL(); |
|
1824 CleanupStack::PushL( media ); |
|
1825 media->InternalizeL( readStream ); |
|
1826 // verification |
|
1827 if ( media->Count() != iMPXMediaArray->Count() ) |
|
1828 { |
|
1829 iLog->Log(_L("Verification Failed: New Array Count=%d, Old Array Count=%d."), |
|
1830 media->Count(), iMPXMediaArray->Count()); |
|
1831 err = KErrUnexpectedValue; |
|
1832 } |
|
1833 CleanupStack::PopAndDestroy( media ); |
|
1834 CleanupStack::PopAndDestroy( &readStream ); |
|
1835 CleanupStack::PopAndDestroy( buffer ); |
|
1836 return err; |
|
1837 } |
|
1838 |
|
1839 // ----------------------------------------------------------------------------- |
|
1840 // CCommonTestClass::MpxMediaCopyL() |
|
1841 // Returns: Symbian OS errors. |
|
1842 // add MpxMediaCopyL to testmpxmedia.cpp 9/18/2008 10:47 |
|
1843 // ----------------------------------------------------------------------------- |
|
1844 TInt CCommonTestClass::MpxMediaCopyL(CStifItemParser& aItem) |
|
1845 { |
|
1846 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaCopyL testing CMPXMedia::CopyL() begin"))); |
|
1847 iLog->Log(_L("CCommonTestClass::MpxMediaCopyL testing CMPXMedia::CopyL() begin")); |
|
1848 TInt err=KErrNone; |
|
1849 TUint index; |
|
1850 // read in parameters |
|
1851 if ( aItem.GetNextInt(index) ) |
|
1852 { |
|
1853 iLog->Log(_L("Missing Parameter: index.")); |
|
1854 return KErrBadTestParameter; |
|
1855 } |
|
1856 if ( !iMPXMediaArray ) |
|
1857 { |
|
1858 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
1859 return KErrBadTestParameter; |
|
1860 } |
|
1861 if ( index >= iMPXMediaArray->Count() ) |
|
1862 { |
|
1863 iLog->Log(_L("Bad Parameter: index out of range.")); |
|
1864 return KErrBadTestParameter; |
|
1865 } |
|
1866 |
|
1867 CMPXMedia* media; |
|
1868 TRAP(err , media= CMPXMedia::NewL()); |
|
1869 CleanupStack::PushL(media); |
|
1870 TRAP(err,iMPXMediaArray->AppendL(media)); |
|
1871 CMPXMedia* media1=media->CopyL(*(*iMPXMediaArray)[index]); |
|
1872 CleanupStack::PushL(media1); |
|
1873 TRAP(err,iMPXMediaArray->AppendL(media1)); |
|
1874 CleanupStack::Pop(media1); |
|
1875 CleanupStack::Pop(media); |
|
1876 return err; |
|
1877 } |
|
1878 // ----------------------------------------------------------------------------- |
|
1879 // CCommonTestClass::MpxMediaDeleteL() |
|
1880 // Returns: Symbian OS errors. |
|
1881 // add MpxMediaDeleteL to testmpxmedia.cpp |
|
1882 // ----------------------------------------------------------------------------- |
|
1883 TInt CCommonTestClass::MpxMediaDeleteL(CStifItemParser&) |
|
1884 { |
|
1885 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaDeleteL testing CMPXMedia::~ begin"))); |
|
1886 iLog->Log(_L("CCommonTestClass::MpxMediaDeleteL testing CMPXMedia::~ begin")); |
|
1887 TInt err = KErrNone; |
|
1888 delete iMPXMediaArray; |
|
1889 iMPXMediaArray = NULL; |
|
1890 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaDeleteL testing CMPXMedia::~ end err=%d"), err)); |
|
1891 iLog->Log(_L("CCommonTestClass::MpxMediaDeleteL testing CMPXMedia::~ end err=%d"), err); |
|
1892 return err; |
|
1893 } |
|
1894 // ----------------------------------------------------------------------------- |
|
1895 // CCommonTestClass::MpxMediaHeapMemoryInfoL() |
|
1896 // Returns: Symbian OS errors. |
|
1897 // add MpxMediaDeleteL to testmpxmedia.cpp |
|
1898 // ----------------------------------------------------------------------------- |
|
1899 TInt CCommonTestClass::MpxMediaHeapMemoryInfoL(CStifItemParser&) |
|
1900 { |
|
1901 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaHeapMemoryInfoL testing CMPXMedia::HeapMemoryInfoL begin"))); |
|
1902 iLog->Log(_L("CCommonTestClass::MpxMediaHeapMemoryInfoL testing CMPXMedia::HeapMemoryInfoL begin")); |
|
1903 |
|
1904 TInt err = KErrNone; |
|
1905 TInt total=0; |
|
1906 TInt used=0; |
|
1907 TInt& aTotal=total; |
|
1908 TInt& aUsed=used; |
|
1909 |
|
1910 CMPXMedia* media; |
|
1911 TRAP(err , media= CMPXMedia::NewL()); |
|
1912 CleanupStack::PushL(media); |
|
1913 TRAP(err,iMPXMediaArray->AppendL(media)); |
|
1914 TRAP(err,media->HeapMemoryInfoL(aTotal,aUsed)); |
|
1915 CleanupStack::Pop(media); |
|
1916 |
|
1917 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaHeapMemoryInfoL testing CMPXMedia::HeapMemoryInfoLend err=%d"), err)); |
|
1918 iLog->Log(_L("CCommonTestClass::MpxMediaHeapMemoryInfoL testing CMPXMedia::HeapMemoryInfoL end err=%d"), err); |
|
1919 return err; |
|
1920 } |
|
1921 |
|
1922 |
|
1923 // ----------------------------------------------------------------------------- |
|
1924 // CCommonTestClass::MpxMediaMergeMediaL() |
|
1925 // Returns: Symbian OS errors. |
|
1926 // add MpxMediaMergeMediaL to testmpxmedia.cpp |
|
1927 // ----------------------------------------------------------------------------- |
|
1928 TInt CCommonTestClass::MpxMediaMergeMediaL(CStifItemParser&) |
|
1929 { |
|
1930 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaMergeMediaL testing CMPXMedia::MergeMediaL begin"))); |
|
1931 iLog->Log(_L("CCommonTestClass::MpxMediaMergeMediaL testing CMPXMedia::MergeMediaL begin")); |
|
1932 TInt err = KErrNone; |
|
1933 TUint index=0; |
|
1934 |
|
1935 CMPXMedia* media; |
|
1936 TRAP(err , media= CMPXMedia::NewL()); |
|
1937 CleanupStack::PushL(media); |
|
1938 TRAP(err,iMPXMediaArray->AppendL(media)); |
|
1939 TRAP(err,media->MergeMediaL(*(*iMPXMediaArray)[index])); |
|
1940 CleanupStack::Pop(media); |
|
1941 |
|
1942 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaMergeMediaL testing CMPXMedia::MergeMediaL err=%d"), err)); |
|
1943 iLog->Log(_L("CCommonTestClass::MpxMediaMergeMediaL testing CMPXMedia::MergeMediaL end err=%d"), err); |
|
1944 return err; |
|
1945 } |
|
1946 |
|
1947 // ----------------------------------------------------------------------------- |
|
1948 // CCommonTestClass::MpxMediaMatchL() |
|
1949 // Returns: Symbian OS errors. |
|
1950 // add MpxMediaMatchL to testmpxmedia.cpp 9/18/2008 10:47 |
|
1951 // ----------------------------------------------------------------------------- |
|
1952 TInt CCommonTestClass::MpxMediaMatchL(CStifItemParser&) |
|
1953 { |
|
1954 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaMatchL testing CMPXMedia::Match begin"))); |
|
1955 iLog->Log(_L("CCommonTestClass::MpxMediaMatchL testing CMPXMedia::Match begin")); |
|
1956 TInt err = KErrNone; |
|
1957 TUint index=0; |
|
1958 |
|
1959 CMPXMedia* media; |
|
1960 TRAP(err , media= CMPXMedia::NewL()); |
|
1961 CleanupStack::PushL(media); |
|
1962 TRAP(err ,iMPXMediaArray->AppendL(media)); |
|
1963 TInt countAttributes = iMPXAttArray.Count(); |
|
1964 TInt countMedias = iMPXMediaArray->Count(); |
|
1965 |
|
1966 if(countAttributes>0 & countMedias>0) |
|
1967 { |
|
1968 for(TInt i=0;i<countAttributes;i++) |
|
1969 { |
|
1970 media->Match(*(*iMPXMediaArray)[index],iMPXAttArray[i]); |
|
1971 } |
|
1972 } |
|
1973 CleanupStack::Pop(media); |
|
1974 |
|
1975 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaMatchL testing CMPXMedia::Match err=%d"), err)); |
|
1976 iLog->Log(_L("CCommonTestClass::MpxMediaMatchL testing CMPXMedia::Match end err=%d"), err); |
|
1977 return err; |
|
1978 } |
|
1979 |
|
1980 |
|
1981 // ----------------------------------------------------------------------------- |
|
1982 // CCommonTestClass::MpxMediaSetErrorL() |
|
1983 // Returns: Symbian OS errors. |
|
1984 // add MpxMediaSetErrorL to testmpxmedia.cpp 9/18/2008 10:47 |
|
1985 // ----------------------------------------------------------------------------- |
|
1986 TInt CCommonTestClass::MpxMediaSetErrorL(CStifItemParser& aItem) |
|
1987 { |
|
1988 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaSetErrorL testing CMPXMedia::SetErrorL() begin"))); |
|
1989 iLog->Log(_L("CCommonTestClass::MpxMediaSetErrorL testing CMPXMedia::SetErrorL() begin")); |
|
1990 TInt err=KErrNone; |
|
1991 TUint mediaIndex; |
|
1992 TUint attIndex; |
|
1993 TInt aError=1; |
|
1994 // read in parameters |
|
1995 if ( aItem.GetNextInt(mediaIndex) ) |
|
1996 { |
|
1997 iLog->Log(_L("Missing Parameter: Media index.")); |
|
1998 return KErrBadTestParameter; |
|
1999 } |
|
2000 if ( !iMPXMediaArray ) |
|
2001 { |
|
2002 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
2003 return KErrBadTestParameter; |
|
2004 } |
|
2005 if ( mediaIndex >= iMPXMediaArray->Count() ) |
|
2006 { |
|
2007 iLog->Log(_L("Bad Parameter: Media index out of range.")); |
|
2008 return KErrBadTestParameter; |
|
2009 } |
|
2010 if ( aItem.GetNextInt(attIndex) ) |
|
2011 { |
|
2012 iLog->Log(_L("Missing Parameter: Attribute index.")); |
|
2013 return KErrBadTestParameter; |
|
2014 } |
|
2015 if ( attIndex >= iMPXAttArray.Count() ) |
|
2016 { |
|
2017 iLog->Log(_L("Bad Parameter: Attribute index out of range.")); |
|
2018 return KErrBadTestParameter; |
|
2019 } |
|
2020 // set Error |
|
2021 (*iMPXMediaArray)[mediaIndex]->SetErrorL(iMPXAttArray[attIndex], aError); |
|
2022 |
|
2023 return err; |
|
2024 } |
|
2025 |
|
2026 |
|
2027 // ----------------------------------------------------------------------------- |
|
2028 // CCommonTestClass::MpxMediaErrorL() |
|
2029 // Returns: Symbian OS errors. |
|
2030 // add MpxMediaErrorL to testmpxmedia.cpp 9/18/2008 10:47 |
|
2031 // ----------------------------------------------------------------------------- |
|
2032 TInt CCommonTestClass::MpxMediaErrorL(CStifItemParser& aItem) |
|
2033 { |
|
2034 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaErrorL testing CMPXMedia::Error() begin"))); |
|
2035 iLog->Log(_L("CCommonTestClass::MpxMediaErrorL testing CMPXMedia::Error() begin")); |
|
2036 TInt err=KErrNone; |
|
2037 TUint mediaIndex; |
|
2038 TUint attIndex; |
|
2039 // read in parameters |
|
2040 if ( aItem.GetNextInt(mediaIndex) ) |
|
2041 { |
|
2042 iLog->Log(_L("Missing Parameter: Media index.")); |
|
2043 return KErrBadTestParameter; |
|
2044 } |
|
2045 if ( !iMPXMediaArray ) |
|
2046 { |
|
2047 iLog->Log(_L("Error: MPXMediaArray not created.")); |
|
2048 return KErrBadTestParameter; |
|
2049 } |
|
2050 if ( mediaIndex >= iMPXMediaArray->Count() ) |
|
2051 { |
|
2052 iLog->Log(_L("Bad Parameter: Media index out of range.")); |
|
2053 return KErrBadTestParameter; |
|
2054 } |
|
2055 if ( aItem.GetNextInt(attIndex) ) |
|
2056 { |
|
2057 iLog->Log(_L("Missing Parameter: Attribute index.")); |
|
2058 return KErrBadTestParameter; |
|
2059 } |
|
2060 if ( attIndex >= iMPXAttArray.Count() ) |
|
2061 { |
|
2062 iLog->Log(_L("Bad Parameter: Attribute index out of range.")); |
|
2063 return KErrBadTestParameter; |
|
2064 } |
|
2065 // Error |
|
2066 (*iMPXMediaArray)[mediaIndex]->Error(iMPXAttArray[attIndex]); |
|
2067 |
|
2068 return err; |
|
2069 } |
|
2070 |
|
2071 // ----------------------------------------------------------------------------- |
|
2072 // CCommonTestClass::MpxMediaInternalizeL() |
|
2073 // Returns: Symbian OS errors. |
|
2074 |
|
2075 // ----------------------------------------------------------------------------- |
|
2076 TInt CCommonTestClass::MpxMediaInternalizeL(CStifItemParser& ) |
|
2077 { |
|
2078 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaInternalizeL testing CMPXMedia::InternalizeL begin"))); |
|
2079 iLog->Log(_L("CCommonTestClass::MpxMediaInternalizeL testing CMPXMedia::InternalizeL begin")); |
|
2080 TInt err = KErrNone; |
|
2081 |
|
2082 if ( iMPXMediaArray != NULL ) |
|
2083 { |
|
2084 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaInternalizeL started InternalizeL"))); |
|
2085 iLog->Log(_L("CCommonTestClass::MpxMediaInternalizeL started InternalizeL")); |
|
2086 CBufBase* buffer = CBufFlat::NewL( 50 ); |
|
2087 CleanupStack::PushL( buffer ); |
|
2088 RBufWriteStream writeStream( *buffer ); |
|
2089 CleanupClosePushL( writeStream ); |
|
2090 iMPXMediaArray->ExternalizeL( writeStream ); |
|
2091 writeStream.CommitL(); |
|
2092 buffer->Compress(); |
|
2093 CleanupStack::PopAndDestroy( &writeStream ); |
|
2094 |
|
2095 RBufReadStream readStream( *buffer ); |
|
2096 CleanupClosePushL( readStream ); |
|
2097 |
|
2098 CMPXMedia* media = CMPXMedia::NewL(); |
|
2099 CleanupStack::PushL(media); |
|
2100 media->InternalizeL(readStream); |
|
2101 CleanupStack::PopAndDestroy( media ); |
|
2102 CleanupStack::PopAndDestroy( &readStream ); |
|
2103 CleanupStack::PopAndDestroy( buffer ); |
|
2104 } |
|
2105 else |
|
2106 { |
|
2107 err = KErrBadTestParameter; |
|
2108 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaInternalizeL Stif test script is wrong."))); |
|
2109 iLog->Log(_L("CCommonTestClass::MpxMediaInternalizeL Stif test script is wrong.")); |
|
2110 } |
|
2111 |
|
2112 |
|
2113 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaInternalizeL testing CMPXMedia::InternalizeL end err=%d"), err)); |
|
2114 iLog->Log(_L("CCommonTestClass::MpxMediaInternalizeL testing CMPXMedia::InternalizeL end err=%d"), err); |
|
2115 return err; |
|
2116 } |
|
2117 |
|
2118 // ----------------------------------------------------------------------------- |
|
2119 // CCommonTestClass::MpxMediaExternalizeL() |
|
2120 // Returns: Symbian OS errors. |
|
2121 // ----------------------------------------------------------------------------- |
|
2122 TInt CCommonTestClass::MpxMediaExternalizeL(CStifItemParser& ) |
|
2123 { |
|
2124 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaExternalizeL testing CMPXMedia::ExternalizeL begin"))); |
|
2125 iLog->Log(_L("CCommonTestClass::MpxMediaExternalizeL testing CMPXMedia::ExternalizeL begin")); |
|
2126 TInt err = KErrNone; |
|
2127 if ( iMPXMediaArray != NULL ) |
|
2128 { |
|
2129 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaExternalizeL started ExternalizeL"))); |
|
2130 iLog->Log(_L("CCommonTestClass::MpxMediaExternalizeL started ExternalizeL")); |
|
2131 CBufBase* buffer = CBufFlat::NewL( 50 ); |
|
2132 CleanupStack::PushL( buffer ); |
|
2133 RBufWriteStream writeStream( *buffer ); |
|
2134 CleanupClosePushL( writeStream ); |
|
2135 iMPXMediaArray->ExternalizeL( writeStream ); |
|
2136 writeStream.CommitL(); |
|
2137 buffer->Compress(); |
|
2138 CleanupStack::PopAndDestroy( &writeStream ); |
|
2139 CleanupStack::PopAndDestroy( buffer ); |
|
2140 } |
|
2141 else |
|
2142 { |
|
2143 err = KErrBadTestParameter; |
|
2144 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaExternalizeL Stif test script is wrong."))); |
|
2145 iLog->Log(_L("CCommonTestClass::MpxMediaExternalizeL Stif test script is wrong.")); |
|
2146 } |
|
2147 FTRACE(FPrint(_L("CCommonTestClass::MpxMediaExternalizeL testing CMPXMedia::ExternalizeL end err=%d"), err)); |
|
2148 iLog->Log(_L("CCommonTestClass::MpxMediaExternalizeL testing CMPXMedia::ExternalizeL end err=%d"), err); |
|
2149 return err; |
|
2150 } |
|
2151 |
|
2152 // end of MPXMedia and MPXMediaArray (mpxmedia.h,mpxmediaarray.h) ============================================= |