photosgallery/viewframework/medialists/tsrc/ut_cglxattributecontext/ut_cglxattributecontext.cpp
equal
deleted
inserted
replaced
44 void CGlxDRMUtility::Close() |
44 void CGlxDRMUtility::Close() |
45 { |
45 { |
46 delete this; |
46 delete this; |
47 } |
47 } |
48 |
48 |
49 TBool CGlxDRMUtility::CheckOpenRightsL(const TDesC&, TBool) |
49 TBool CGlxDRMUtility::ItemRightsValidityCheckL(const TDesC&, TBool) |
50 { |
50 { |
51 return ETrue; |
51 return ETrue; |
52 } |
52 } |
53 |
53 |
54 CGlxDRMUtility* CGlxDRMUtility::InstanceL() |
54 CGlxDRMUtility* CGlxDRMUtility::InstanceL() |
74 |
74 |
75 // CONSTRUCTION |
75 // CONSTRUCTION |
76 UT_CGlxAttributeContext* UT_CGlxAttributeContext::NewL() |
76 UT_CGlxAttributeContext* UT_CGlxAttributeContext::NewL() |
77 { |
77 { |
78 UT_CGlxAttributeContext* self = UT_CGlxAttributeContext::NewLC(); |
78 UT_CGlxAttributeContext* self = UT_CGlxAttributeContext::NewLC(); |
79 CleanupStack::Pop(); |
79 CleanupStack::Pop( self ); |
80 |
|
81 return self; |
80 return self; |
82 } |
81 } |
83 |
82 |
84 UT_CGlxAttributeContext* UT_CGlxAttributeContext::NewLC() |
83 UT_CGlxAttributeContext* UT_CGlxAttributeContext::NewLC() |
85 { |
84 { |
198 EUNIT_ASSERT(attributes.Count() == 0); |
197 EUNIT_ASSERT(attributes.Count() == 0); |
199 |
198 |
200 delete attributeSpecs; |
199 delete attributeSpecs; |
201 attributeSpecs = NULL; |
200 attributeSpecs = NULL; |
202 |
201 |
203 CleanupStack::Pop(); |
202 CleanupStack::Pop( attributes ); |
204 attributes.Close(); |
203 attributes.Close(); |
205 |
204 |
206 CleanupStack::Pop(); |
205 CleanupStack::Pop( itemIndices ); |
207 itemIndices.Close(); |
206 itemIndices.Close(); |
208 |
207 |
209 CleanupStack::PopAndDestroy(); |
208 CleanupStack::PopAndDestroy( mediaList ); |
210 } |
209 } |
211 |
210 |
212 void UT_CGlxAttributeContext::FetchOneItem_IndexZeroL() |
211 void UT_CGlxAttributeContext::FetchOneItem_IndexZeroL() |
213 { |
212 { |
214 // Fetch 1 item with focus on index 0 |
213 // Fetch 1 item with focus on index 0 |
239 EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); |
238 EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); |
240 |
239 |
241 delete attributeSpecs; |
240 delete attributeSpecs; |
242 attributeSpecs = NULL; |
241 attributeSpecs = NULL; |
243 |
242 |
244 CleanupStack::Pop(); |
243 CleanupStack::Pop(attributes); |
245 attributes.Close(); |
244 attributes.Close(); |
246 |
245 |
247 CleanupStack::Pop(); |
246 CleanupStack::Pop(itemIndices); |
248 itemIndices.Close(); |
247 itemIndices.Close(); |
249 |
248 |
250 CleanupStack::PopAndDestroy(); |
249 CleanupStack::PopAndDestroy(mediaList); |
251 } |
250 } |
252 |
251 |
253 void UT_CGlxAttributeContext::FetchOneItem_IndexOneL() |
252 void UT_CGlxAttributeContext::FetchOneItem_IndexOneL() |
254 { |
253 { |
255 // Fetch 1 item with focus on index 1 |
254 // Fetch 1 item with focus on index 1 |
280 EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); |
279 EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); |
281 |
280 |
282 delete attributeSpecs; |
281 delete attributeSpecs; |
283 attributeSpecs = NULL; |
282 attributeSpecs = NULL; |
284 |
283 |
285 CleanupStack::Pop(); |
284 CleanupStack::Pop(attributes); |
286 attributes.Close(); |
285 attributes.Close(); |
287 |
286 |
288 CleanupStack::Pop(); |
287 CleanupStack::Pop(itemIndices); |
289 itemIndices.Close(); |
288 itemIndices.Close(); |
290 |
289 |
291 CleanupStack::PopAndDestroy(); |
290 CleanupStack::PopAndDestroy(mediaList); |
292 } |
291 } |
293 |
292 |
294 void UT_CGlxAttributeContext::FetchOneItem_IndexTwoL() |
293 void UT_CGlxAttributeContext::FetchOneItem_IndexTwoL() |
295 { |
294 { |
296 // Fetch 1 item with focus on index 2 |
295 // Fetch 1 item with focus on index 2 |
321 EUNIT_ASSERT((attributes.Count() == 1) && !titleAttributeFound && dateAttributeFound); |
320 EUNIT_ASSERT((attributes.Count() == 1) && !titleAttributeFound && dateAttributeFound); |
322 |
321 |
323 delete attributeSpecs; |
322 delete attributeSpecs; |
324 attributeSpecs = NULL; |
323 attributeSpecs = NULL; |
325 |
324 |
326 CleanupStack::Pop(); |
325 CleanupStack::Pop(attributes); |
327 attributes.Close(); |
326 attributes.Close(); |
328 |
327 |
329 CleanupStack::Pop(); |
328 CleanupStack::Pop(itemIndices); |
330 itemIndices.Close(); |
329 itemIndices.Close(); |
331 |
330 |
332 CleanupStack::PopAndDestroy(); |
331 CleanupStack::PopAndDestroy(mediaList); |
333 } |
332 } |
334 |
333 |
335 void UT_CGlxAttributeContext::FetchOneItem_IndexThreeL() |
334 void UT_CGlxAttributeContext::FetchOneItem_IndexThreeL() |
336 { |
335 { |
337 // Fetch 1 item with focus on index 3 |
336 // Fetch 1 item with focus on index 3 |
362 EUNIT_ASSERT((attributes.Count() == 1) && titleAttributeFound && !dateAttributeFound); |
361 EUNIT_ASSERT((attributes.Count() == 1) && titleAttributeFound && !dateAttributeFound); |
363 |
362 |
364 delete attributeSpecs; |
363 delete attributeSpecs; |
365 attributeSpecs = NULL; |
364 attributeSpecs = NULL; |
366 |
365 |
367 CleanupStack::Pop(); |
366 CleanupStack::Pop(attributes); |
368 attributes.Close(); |
367 attributes.Close(); |
369 |
368 |
370 CleanupStack::Pop(); |
369 CleanupStack::Pop(itemIndices); |
371 itemIndices.Close(); |
370 itemIndices.Close(); |
372 |
371 |
373 CleanupStack::PopAndDestroy(); |
372 CleanupStack::PopAndDestroy(mediaList); |
374 } |
373 } |
375 |
374 |
376 void UT_CGlxAttributeContext::FetchOneItem_IndexFourL() |
375 void UT_CGlxAttributeContext::FetchOneItem_IndexFourL() |
377 { |
376 { |
378 // Fetch 1 item with focus on index 4 |
377 // Fetch 1 item with focus on index 4 |
403 EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); |
402 EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); |
404 |
403 |
405 delete attributeSpecs; |
404 delete attributeSpecs; |
406 attributeSpecs = NULL; |
405 attributeSpecs = NULL; |
407 |
406 |
408 CleanupStack::Pop(); |
407 CleanupStack::Pop(attributes); |
409 attributes.Close(); |
408 attributes.Close(); |
410 |
409 |
411 CleanupStack::Pop(); |
410 CleanupStack::Pop(itemIndices); |
412 itemIndices.Close(); |
411 itemIndices.Close(); |
413 |
412 |
414 CleanupStack::PopAndDestroy(); |
413 CleanupStack::PopAndDestroy(mediaList); |
415 } |
414 } |
416 |
415 |
417 void UT_CGlxAttributeContext::FetchItems_GranularityLessThanRange_IndexZeroL() |
416 void UT_CGlxAttributeContext::FetchItems_GranularityLessThanRange_IndexZeroL() |
418 { |
417 { |
419 // Fetch items with focus on index 0 (granularity less than range) |
418 // Fetch items with focus on index 0 (granularity less than range) |
444 EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); |
443 EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); |
445 |
444 |
446 delete attributeSpecs; |
445 delete attributeSpecs; |
447 attributeSpecs = NULL; |
446 attributeSpecs = NULL; |
448 |
447 |
449 CleanupStack::Pop(); |
448 CleanupStack::Pop(attributes); |
450 attributes.Close(); |
449 attributes.Close(); |
451 |
450 |
452 CleanupStack::Pop(); |
451 CleanupStack::Pop(itemIndices); |
453 itemIndices.Close(); |
452 itemIndices.Close(); |
454 |
453 |
455 CleanupStack::PopAndDestroy(); |
454 CleanupStack::PopAndDestroy(mediaList); |
456 } |
455 } |
457 |
456 |
458 void UT_CGlxAttributeContext::FetchItems_GranularityLessThanRange_IndexOneL() |
457 void UT_CGlxAttributeContext::FetchItems_GranularityLessThanRange_IndexOneL() |
459 { |
458 { |
460 // Fetch items with focus on index 1 (granularity less than range) |
459 // Fetch items with focus on index 1 (granularity less than range) |
485 EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); |
484 EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); |
486 |
485 |
487 delete attributeSpecs; |
486 delete attributeSpecs; |
488 attributeSpecs = NULL; |
487 attributeSpecs = NULL; |
489 |
488 |
490 CleanupStack::Pop(); |
489 CleanupStack::Pop(attributes); |
491 attributes.Close(); |
490 attributes.Close(); |
492 |
491 |
493 CleanupStack::Pop(); |
492 CleanupStack::Pop(itemindices); |
494 itemIndices.Close(); |
493 itemIndices.Close(); |
495 |
494 |
496 CleanupStack::PopAndDestroy(); |
495 CleanupStack::PopAndDestroy(mediaList); |
497 } |
496 } |
498 |
497 |
499 void UT_CGlxAttributeContext::FetchItems_GranularityLessThanRange_IndexTwoL() |
498 void UT_CGlxAttributeContext::FetchItems_GranularityLessThanRange_IndexTwoL() |
500 { |
499 { |
501 // Fetch items with focus on index 2 (granularity less than range) |
500 // Fetch items with focus on index 2 (granularity less than range) |
526 EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); |
525 EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); |
527 |
526 |
528 delete attributeSpecs; |
527 delete attributeSpecs; |
529 attributeSpecs = NULL; |
528 attributeSpecs = NULL; |
530 |
529 |
531 CleanupStack::Pop(); |
530 CleanupStack::Pop(attributes); |
532 attributes.Close(); |
531 attributes.Close(); |
533 |
532 |
534 CleanupStack::Pop(); |
533 CleanupStack::Pop(itemIndices); |
535 itemIndices.Close(); |
534 itemIndices.Close(); |
536 |
535 |
537 CleanupStack::PopAndDestroy(); |
536 CleanupStack::PopAndDestroy(mediaList); |
538 } |
537 } |
539 |
538 |
540 void UT_CGlxAttributeContext::FetchItems_GranularityLessThanRange_IndexThreeL() |
539 void UT_CGlxAttributeContext::FetchItems_GranularityLessThanRange_IndexThreeL() |
541 { |
540 { |
542 // Fetch items with focus on index 3 (granularity less than range) |
541 // Fetch items with focus on index 3 (granularity less than range) |
567 EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); |
566 EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); |
568 |
567 |
569 delete attributeSpecs; |
568 delete attributeSpecs; |
570 attributeSpecs = NULL; |
569 attributeSpecs = NULL; |
571 |
570 |
572 CleanupStack::Pop(); |
571 CleanupStack::Pop(attributes); |
573 attributes.Close(); |
572 attributes.Close(); |
574 |
573 |
575 CleanupStack::Pop(); |
574 CleanupStack::Pop(itemIndices); |
576 itemIndices.Close(); |
575 itemIndices.Close(); |
577 |
576 |
578 CleanupStack::PopAndDestroy(); |
577 CleanupStack::PopAndDestroy(mediaList); |
579 } |
578 } |
580 |
579 |
581 void UT_CGlxAttributeContext::FetchItems_GranularityLessThanRange_IndexFourL() |
580 void UT_CGlxAttributeContext::FetchItems_GranularityLessThanRange_IndexFourL() |
582 { |
581 { |
583 // Fetch items with focus on index 4 (granularity less than range) |
582 // Fetch items with focus on index 4 (granularity less than range) |
608 EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); |
607 EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); |
609 |
608 |
610 delete attributeSpecs; |
609 delete attributeSpecs; |
611 attributeSpecs = NULL; |
610 attributeSpecs = NULL; |
612 |
611 |
613 CleanupStack::Pop(); |
612 CleanupStack::Pop(attributes); |
614 attributes.Close(); |
613 attributes.Close(); |
615 |
614 |
616 CleanupStack::Pop(); |
615 CleanupStack::Pop(itemIndices); |
617 itemIndices.Close(); |
616 itemIndices.Close(); |
618 |
617 |
619 CleanupStack::PopAndDestroy(); |
618 CleanupStack::PopAndDestroy(mediaList); |
620 } |
619 } |
621 |
620 |
622 void UT_CGlxAttributeContext::FetchItems_GranularityLessThanRange_IndexFiveL() |
621 void UT_CGlxAttributeContext::FetchItems_GranularityLessThanRange_IndexFiveL() |
623 { |
622 { |
624 // Fetch items with focus on index 5 (granularity less than range) |
623 // Fetch items with focus on index 5 (granularity less than range) |
649 EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); |
648 EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); |
650 |
649 |
651 delete attributeSpecs; |
650 delete attributeSpecs; |
652 attributeSpecs = NULL; |
651 attributeSpecs = NULL; |
653 |
652 |
654 CleanupStack::Pop(); |
653 CleanupStack::Pop(attributes); |
655 attributes.Close(); |
654 attributes.Close(); |
656 |
655 |
657 CleanupStack::Pop(); |
656 CleanupStack::Pop(itemIndices); |
658 itemIndices.Close(); |
657 itemIndices.Close(); |
659 |
658 |
660 CleanupStack::PopAndDestroy(); |
659 CleanupStack::PopAndDestroy(mediaList); |
661 } |
660 } |
662 |
661 |
663 void UT_CGlxAttributeContext::FetchItems_GranularityGreaterThanRangeL() |
662 void UT_CGlxAttributeContext::FetchItems_GranularityGreaterThanRangeL() |
664 { |
663 { |
665 // Fetch items with focus on index 4 (granularity greater than range) |
664 // Fetch items with focus on index 4 (granularity greater than range) |
690 EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); |
689 EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); |
691 |
690 |
692 delete attributeSpecs; |
691 delete attributeSpecs; |
693 attributeSpecs = NULL; |
692 attributeSpecs = NULL; |
694 |
693 |
695 CleanupStack::Pop(); |
694 CleanupStack::Pop(attributes); |
696 attributes.Close(); |
695 attributes.Close(); |
697 |
696 |
698 CleanupStack::Pop(); |
697 CleanupStack::Pop(itemIndices); |
699 itemIndices.Close(); |
698 itemIndices.Close(); |
700 |
699 |
701 CleanupStack::PopAndDestroy(); |
700 CleanupStack::PopAndDestroy(mediaList); |
702 } |
701 } |
703 |
702 |
704 TBool UT_CGlxAttributeContext::FindAttribute(RArray<TMPXAttribute>& aAttributes, const TMPXAttribute& aAttribute) |
703 TBool UT_CGlxAttributeContext::FindAttribute(RArray<TMPXAttribute>& aAttributes, const TMPXAttribute& aAttribute) |
705 { |
704 { |
706 TIdentityRelation<TMPXAttribute> match(&TMPXAttribute::Match); |
705 TIdentityRelation<TMPXAttribute> match(&TMPXAttribute::Match); |
716 UT_CGlxAttributeContext::CGlxMediaListTest* UT_CGlxAttributeContext::CGlxMediaListTest::NewL(TUint aNumberOfMedia) |
715 UT_CGlxAttributeContext::CGlxMediaListTest* UT_CGlxAttributeContext::CGlxMediaListTest::NewL(TUint aNumberOfMedia) |
717 { |
716 { |
718 CGlxMediaListTest* self = new (ELeave) CGlxMediaListTest(); |
717 CGlxMediaListTest* self = new (ELeave) CGlxMediaListTest(); |
719 CleanupStack::PushL(self); |
718 CleanupStack::PushL(self); |
720 self->ConstructL(aNumberOfMedia); |
719 self->ConstructL(aNumberOfMedia); |
721 CleanupStack::Pop(); |
720 CleanupStack::Pop(self); |
722 return self; |
721 return self; |
723 } |
722 } |
724 |
723 |
725 UT_CGlxAttributeContext::CGlxMediaListTest::~CGlxMediaListTest() |
724 UT_CGlxAttributeContext::CGlxMediaListTest::~CGlxMediaListTest() |
726 { |
725 { |
775 cGlxMedia->SetTextValueL(KMPXMediaGeneralTitle, _L("Title")); |
774 cGlxMedia->SetTextValueL(KMPXMediaGeneralTitle, _L("Title")); |
776 cGlxMedia->SetTextValueL(KMPXMediaGeneralDate, _L("Date")); |
775 cGlxMedia->SetTextValueL(KMPXMediaGeneralDate, _L("Date")); |
777 } |
776 } |
778 |
777 |
779 iMedias.AppendL(cGlxMedia); |
778 iMedias.AppendL(cGlxMedia); |
780 CleanupStack::Pop(); |
779 CleanupStack::Pop(cGlxMedia); |
781 } |
780 } |
782 |
781 |
783 TGlxMedia tGlxMedia(id, cGlxMedia); |
782 TGlxMedia tGlxMedia(id, cGlxMedia); |
784 iItems.AppendL(tGlxMedia); |
783 iItems.AppendL(tGlxMedia); |
785 } |
784 } |